PDA

View Full Version : [SOLVED:] For Next Skips If Statement in between the For and Next



cleteh
03-06-2017, 09:33 AM
18560

My code in the attachment reads the FOR line then skips to the LastRow line without executing the if statement in the middle. I pasted a screen shot of the code. I will also copy the code below.

'Set the value I equal to 3
i = 3
'Check the value in column C and color everything to the right accordingly
For i = 3 To LastRow
If IsEmpty(objXLSheet.Range("S" & i)) Then
objXLSheet.Range("S" & i) = "Open"
End If
Next i
LastRow = 0
i = 0

jonh
03-06-2017, 09:49 AM
You've set Lastrow to 0 above that.


Or, if you want to step backwards


For i = 3 To LastRow step -1