C
ceemo
I have the below code which rins really slow and i think it would be
better as a for range = 1 to 500 and then using next
Please could someone help me adapt it to do just that
Basically it looks in column a between rows 1 to 500 and for each cell
that has a y value it hides that row
Sub AutoHidePlanRows()
Let Chk = "Y"
With Worksheets("Plan").Range("a1:a500")
Set c = .Find(Chk, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
'Hide cell here
Let MyAdd = c.Row
LetMyRow = MyAdd & ":" & MyAdd
Range(LetMyRow).Select
Selection.EntireRow.Hidden = True
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
better as a for range = 1 to 500 and then using next
Please could someone help me adapt it to do just that
Basically it looks in column a between rows 1 to 500 and for each cell
that has a y value it hides that row
Sub AutoHidePlanRows()
Let Chk = "Y"
With Worksheets("Plan").Range("a1:a500")
Set c = .Find(Chk, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
'Hide cell here
Let MyAdd = c.Row
LetMyRow = MyAdd & ":" & MyAdd
Range(LetMyRow).Select
Selection.EntireRow.Hidden = True
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub