unhide all rows without loop

  • Thread starter Thread starter Saladin Andreas
  • Start date Start date
S

Saladin Andreas

using "hide rows" instead of autofilter (which works not so well) gives a
problem if you wanna see all rows again. How can you do that without looping
trough all possible rows (given that you don't know whether there are 100 or
30'000).

How can you find out about how many rows there are (if you have to do it
with a loop you should not loop endlessly) When hiding it is easy to leave
the loop when empty rows occur.

For hiding the rows I use this macro:

Sub Hide_completed()

Dim x As Integer

For x = 11 To 20000

If Cells(x, 4).Value = "" Then
Exit For
Else

If Cells(x, 11).Value Like "*completed*" Then
Cells(x, 11).EntireRow.Hidden = True
Else

If Cells(x, 11).Value = "" Then
Cells(x, 11).Value = "still_to_do"
End If


Cells(x, 11).EntireRow.Hidden = False
End If
End If
Next x

End Sub
 
Back
Top