Thread: [Solved] how to view hidden rows
View Single Post
 
Old 01-24-2012, 06:43 AM
JBeaucaire JBeaucaire is offline Windows XP Office 2003
Advanced Beginner
 
Join Date: Dec 2011
Posts: 51
JBeaucaire is on a distinguished road
Default

If any rows are hidden with an AutoFilter, this won't work. Otherwise, this will hide all rows on the activesheet except the ones that match your input value:

Code:
Sub ShowOnlyCertainRows() 
Dim RowNum As Long, LR As Long, Rw As Long  
RowNum = Application.InputBox("Show rows that are multiple of what number?", "Multiples of...", 3, Type:=1) 
If RowNum = 0 Then Exit Sub  

Application.ScreenUpdating = False 
With ActiveSheet  
   .UsedRange.Rows.Hidden = False       'unhides all rows, doesn't work on AutoFilter
    LR = .Range("A" & .Rows.Count).End(xlUp).Row  
    For Rw = 1 To LR 
        If .Range("A" & Rw).Row Mod RowNum <> 0 Then .Rows(Rw).Hidden = True 
    Next Rw 
End With 

Application.ScreenUpdating = True  
End Sub

Also posted: http://www.mrexcel.com/forum/showthread.php?t=607766
Reply With Quote