K. Georgiadis
04-08-2006, 12:12 PM
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:
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
Why is i=5?
In the line:
If Left(Range("A" & i), 4) = "Auto" Then
what is the purpose of 4 inside the brackets and where is "Auto" being read?
All very fundamental, but I am easily confused! :(
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
Why is i=5?
In the line:
If Left(Range("A" & i), 4) = "Auto" Then
what is the purpose of 4 inside the brackets and where is "Auto" being read?
All very fundamental, but I am easily confused! :(