ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unhide all rows without loop (https://www.excelbanter.com/excel-programming/427055-unhide-all-rows-without-loop.html)

Saladin Andreas[_2_]

unhide all rows without loop
 
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

Saladin Andreas[_2_]

unhide all rows without loop
 
thanks but this doesn't work - runtime error

Saladin Andreas[_2_]

unhide all rows without loop
 
thanks, this works great and is also fast


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com