Jason44136
New Member
- Joined
- Jul 8, 2019
- Messages
- 18
- Office Version
- 365
- Platform
- Windows
Greetings - I have learned a lot over the years from reviewing these threads. I'm hoping someone can assist. I have a workbook with 33 sheets. Two summary sheets and 31 data sheets. The first sheet "Monthly" has data within that will be changed regularly. All other sheets have an A column that has formulas built to show a "1" if criteria determines the row should be hidden. The "Monthly" tab also has an A column that is blank and will NOT be impacted by the VBA (as it shouldnt) because there is no "1" in column A anywhere.
I found the below code which does work, but it takes multiple minutes to run. Does anyone have a different suggestion on code to quickly hide all rows with a "1" in column A for all sheets?
(There are only 60 rows per sheet)
Sub doStuff()
Dim i As Worksheet, myLoop As Long
For Each i In Worksheets
With i
For myLoop = 1 To 100
If .Cells(myLoop, "A").Value = 1 Then
.Rows(myLoop).Hidden = True
Else
.Rows(myLoop).Hidden = False
End If
Next myLoop
End With
Next i
End Sub
I found the below code which does work, but it takes multiple minutes to run. Does anyone have a different suggestion on code to quickly hide all rows with a "1" in column A for all sheets?
(There are only 60 rows per sheet)
Sub doStuff()
Dim i As Worksheet, myLoop As Long
For Each i In Worksheets
With i
For myLoop = 1 To 100
If .Cells(myLoop, "A").Value = 1 Then
.Rows(myLoop).Hidden = True
Else
.Rows(myLoop).Hidden = False
End If
Next myLoop
End With
Next i
End Sub