0

I made a code to hide some rows using .hidden = True that I don't need to show to make some checks, but I after that I want to show all the data again, so I made this code:

Sub show_hidden_cells()
Dim line As Range
Dim rng As Range
Set rng = Range("Tb_Data[Date]")

For Each line In rng
    If line.SpecialCells(xlCellTypeVisible) = False Then
        line.EntireRow.Hidden = False
    End If
Next line
End Sub

My data has 50.000 rows and my computer it's not really fast, so I don't want to check every cell if is visible, instead of that I want to select only the hidden cells.

EDIT. Thanks to @Rory and @Flephal who helped me my code now is:

Sub show_hidden_cells()
Dim rng As Range
Set rng = Range("Tb_Data[Date]")
rng.EntireRow.Hidden = False
End Sub
ed2
  • 1,457
  • 1
  • 9
  • 26
Vinicius
  • 458
  • 1
  • 4
  • 11
  • Possible duplicate of [vba code to select only visible cells in specific column except heading](http://stackoverflow.com/questions/32425791/vba-code-to-select-only-visible-cells-in-specific-column-except-heading) – Koby Douek Mar 13 '17 at 14:54
  • 2
    Why not just use `rng.EntireRow.Hidden = False` without the loop? – Rory Mar 13 '17 at 15:02
  • 3
    Why test the rows when you want to unhide all the data in the specified range? Just use rng.EntireRow.Hidden = False – Tragamor Mar 13 '17 at 15:02
  • @KobyDouek I don't understand how this post can help me. I already know how to select only the visible cells (using .SpecialCells(xlCellTypeVisible)) my problem is the opposite and I don't see in the post some way to help me, Would you please highlight me where in the post is the code I need? – Vinicius Mar 13 '17 at 15:06
  • Rory and Flephal I didn't know I can use this and it works as I want, thanks so much. :D – Vinicius Mar 13 '17 at 15:11

0 Answers0