Bill Warren
asked on
Hiding groups of Rows in multiple Worksheets in Excel
I Have this Macro to hide a group of Rows in Excel, What would be the way to apply it to multiple Worksheets?
Sub HideRows()
Dim cell As Range
For Each cell In Range("J7:J1452")
If Not IsEmpty(cell) Then
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
End If
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In my answer above the
Next
End Sub
should also be in the code.
Next
End Sub
should also be in the code.
ASKER
Is there a way to specify exactly which worksheets as opposed to all of them?
Sure. See post ID 40749615.
To specify worksheets..Change this line..
to this..Assuming you want to run for sheet1 and sheet2 only..
Saurabh...
If UCase(ws.Name) <> "SHEET1" And UCase(ws.Name) <> "SHEET2" Then
to this..Assuming you want to run for sheet1 and sheet2 only..
If UCase(ws.Name) = "SHEET1" Or UCase(ws.Name) = "SHEET2" Then
Saurabh...
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Open in new window
Please note if statement in VB is case sensitive that's why i have converted your ws.name in upper case in VB...
Saurabh...