Reputation: 41
I have a piece of code in which i would like the for loop to continue to the next value of i
if the value in a cell is "nil"
and not execute the commands in the loop. I am unable to figure it out.
For i = 2 To n
If .Cells(i, "G").Value = "nil" Then
next i
Else
mon = month(.Cells(i, "G").Value)
acctyp = .Cells(i, "P").Value
end if
next i
Thanks in advance.
Upvotes: 1
Views: 125
Reputation: 21619
The comparison operator <>
means "not equal to":
For i = 2 To n
If .Cells(i, "G") <> "nil" Then
mon = Month(.Cells(i, "G"))
acctyp = .Cells(i, "P")
End If
Next i
Upvotes: 4