Private Sub CommandButton1_Click()
finalRow = Range("A65536").End(xlUp).Row
For i = 2 To finalRow
If (length( Cells(i, 1)) mod 2) = 0 Then
Cells(i, 2) = "双"
With Cells(i, 2).Interior
.ColorIndex = 41
.Pattern = xlSolid
End With
Else
Cells(i, 2) = "单"
With Cells(i, 2).Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If
Next i
End Sub
Private Sub CommandButton1_Click()
finalRow = Range("A65536").End(xlUp).Row
For i = 2 To finalRow
myValue = Cells(i, 1)
myValue = Int(myValue)
MyStr = Right(myValue, 1)
a = MyStr Mod 2
If a = 0 Then
Cells(i, 2) = "双"
With Cells(i, 2).Interior
.ColorIndex = 41
.Pattern = xlSolid
End With
Else
Cells(i, 2) = "单"
With Cells(i, 2).Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If
Next i
End Sub