Hi,
I have an issue with my loop. It doesn't loop through the sheets and stays on the activesheet. I think the problem is coming from the code I have highlighted in red. However, I'm short on ideas on how to correct the situation.
Option Explicit
Dim cel As Range, rng As Range
Sub HideRows()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
On Error Resume Next
Set rng = ActiveSheet.UsedRange
For Each cel In rng
On Error Resume Next
If cel.Value = "Content Retail" Then
Range(cel, cel.Offset(46, 0)).EntireRow.Hidden = True
End If
If cel.Value = "GROSS MARGIN - TOTAL" Then
Range(cel, cel.Offset(1, 0)).EntireRow.Hidden = True
End If
If cel.Value = "OPERATING EXPENSES" Then
Range(cel.Offset(1, 0), cel.Offset(9, 0)).EntireRow.Hidden = True
End If
If cel.Value = "General Administration" Then
Range(cel, cel.Offset(10, 0)).EntireRow.Hidden = True
End If
If cel.Value = "DIRECT EXPENSES before Mktg" Then
Range(cel, cel.Offset(12, 0)).EntireRow.Hidden = True
End If
If cel.Value = "Depreciation" Then
Range(cel, cel.End(xlDown)).EntireRow.Hidden = True
End If
Next cel
Set rng = Nothing
Next ws
Application.ScreenUpdating = True
End Sub
Bookmarks