Hello All
I have a workbook with sheets that have a "Hide Blank Rows" Button, the macro that
runs it works fine for the sheet that it is on, however when I duplicate the sheet it
won't work anymore, so I need it to reference to the "ActiveSheet" instead of the
named sheet. I tried messing with it, but seem not to be able to get it to work.
Option Explicit
Sub Hide_Blank_Rows()
Dim LR As Long, iRow As Long
Dim rCell As Range
Dim iCount As Integer
ActiveSheet.Unprotect Password:=""
Application.ScreenUpdating = False
LR = Sheets("Apr 30 - May 5").UsedRange.SpecialCells(xlCellTypeLastCell).Row
For iRow = LR To 8 Step -1
iCount = Application.WorksheetFunction.CountBlank(Sheets("Apr 30 - May 5").Range("B" & iRow, "M" & iRow))
If iCount = 12 Then
Sheets("Apr 30 - May 5").Range("B" & iRow).EntireRow.Hidden = True
End If
Next iRow
Application.ScreenUpdating = True
ActiveSheet.Protect Password:=""
End Sub
The "Apr 30 - May 5" is the sheet name, but I need it to refer to the ActiveSheet?
Any help, would be very much appreciated. Thanks
Bookmarks