Hi guys,

Some help please. I am trying to get my module to run through every worksheet in the workbook and delete all the hidden rows.

My code doesn't work. It runs through the entire module without an error, but does nothing. It doesn't delete any rows and doesn't swith through the worksheets. If I break the loop, the worksheet name is empty.

What am I missing?

Here is the code:
Code:
Sub DeleteHiddenRows()

Dim dataSheet As Worksheet


For Each dataSheet In ThisWorkbook.Worksheets
   Dim lstRow As Integer
    
    lstRow = ActiveCell.SpecialCells(xlCellTypeLastCell).Row
        Dim i As Integer
        For i = lstRow To 1 Step -1
            If Cells(1, i).EntireRow.Hidden Then
                Cells(1, i).EntireRow.Delete
            End If
        Next i
Next dataSheet

End Sub
Thanks