I'm having trouble with my i
loop. For some reason, my loop only goes through the first iteration (i=0
) and then stops. Here is my code:
Private Sub DeleteFillerRows()
Dim firstRow As Integer
Dim lastRow As Integer
Dim searchRange As Range
Dim i As Integer
For i = 0 To i = 2
If i = 0 Then
lastRow = 1
End If
MsgBox (i) 'used for testing, only displays the first i (0)
Set searchRange = Range("A" & CStr(lastRow) & ":A1000")
firstRow = searchRange.Find(What:="Name /", LookAt:=xlWhole).Row
MsgBox (firstRow)
lastRow = searchRange.Find(What:="Region 1", LookAt:=xlWhole).Row - 2
MsgBox (lastRow)
Next i
End Sub
Can anyone help me with this? I feel dumb asking about a simple i loop but I just can't see where I could have gone wrong.