
Sub a()
For r = 1 To 3
If Cells(r, 1).Value And 1 Then
Cells(r, 2).Value = -Cells(r, 1).Value
End If
Next
End Sub |
Sub b()
For r = 1 To 3
If Cells(r, 1).Value Mod 2 = 1 Then
Cells(r, 2).Value = -Cells(r, 1).Value
End If
Next
End Sub |
Option Explicit
Sub Demo()
With WorksheetFunction
Debug.Print .IsOdd(2)
Debug.Print .IsEven(2)
Debug.Print .IsOdd(1)
Debug.Print .IsEven(1)
End With
End Sub |
