Originally Posted by
K. Georgiadis
I have received this code (I believe from Firefytr) and it worked perfectly in the attached workbook. Even though I have learnt other techniques for hide\ing/unhiding rows, I want to be certain I understand how this code works so that I can adapt it to other situations where the number of rows per block is different:
[vba]
Private Sub OptionButton1_Click()
' Auto populate
For i = 5 To Range("A65536").End(xlUp).Row
If Left(Range("A" & i), 4) = "Auto" Then
Rows(i & ":" & i).EntireRow.Hidden = False
Rows(i + 1 & ":" & i + 1).EntireRow.Hidden = True
Range("G4") = True
End If
Next
End Sub
[/vba]
Why is i=5?