tommychowdah
New Member
- Joined
- Dec 26, 2017
- Messages
- 31
Hi!
I have a macro that loops throughout a list of tab names. The macro is only applied to certain tabs. The macro fails on the "Sheets(w).Select" line. Any suggestions?
Sub Hide_Unused_Rows()
Dim ws As Worksheet
Dim Worksheets As Variant
Application.ScreenUpdating = False
Worksheets = Range("TAB_ROWS").Value
For Each w In Worksheets
Sheets(w).Select
For H = 1 To 10000
If Cells(H, 27).Value = "1" Then
Cells(H, 27).EntireRow.Hidden = False
Else
Cells(H, 27).EntireRow.Hidden = True
End If
Next H
Next w
Application.ScreenUpdating = True
End Sub
I have a macro that loops throughout a list of tab names. The macro is only applied to certain tabs. The macro fails on the "Sheets(w).Select" line. Any suggestions?
Sub Hide_Unused_Rows()
Dim ws As Worksheet
Dim Worksheets As Variant
Application.ScreenUpdating = False
Worksheets = Range("TAB_ROWS").Value
For Each w In Worksheets
Sheets(w).Select
For H = 1 To 10000
If Cells(H, 27).Value = "1" Then
Cells(H, 27).EntireRow.Hidden = False
Else
Cells(H, 27).EntireRow.Hidden = True
End If
Next H
Next w
Application.ScreenUpdating = True
End Sub