Hello everyone,
I would appreciate some help with this macro. I have two sheets. Sheet 1 is where I want the macro button to be and Sheet 2 is where I want it to do its thing. I want to hide all rows between 108 to 197 that are empty at column A. I have the following macro which works, but does its thing on Sheet 1 and not Sheet 2! Please help! Thank you!
Sub HideBlankRows()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim i As Integer
For Each ws In ThisWorkbook.Worksheets
For i = 108 To 197
If ws.Name = "Sheet 2" And Cells(i, "A") = "" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
Next ws
Application.ScreenUpdating = True
End Sub
I would appreciate some help with this macro. I have two sheets. Sheet 1 is where I want the macro button to be and Sheet 2 is where I want it to do its thing. I want to hide all rows between 108 to 197 that are empty at column A. I have the following macro which works, but does its thing on Sheet 1 and not Sheet 2! Please help! Thank you!
Sub HideBlankRows()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim i As Integer
For Each ws In ThisWorkbook.Worksheets
For i = 108 To 197
If ws.Name = "Sheet 2" And Cells(i, "A") = "" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
Next ws
Application.ScreenUpdating = True
End Sub