biker12345
New Member
- Joined
- Aug 20, 2018
- Messages
- 4
So I have two worksheets (Sheet1 and Sheet2). I need to hide the row if the value in column2 = 0. I have found the code to hide the rows (see below), but the code takes forever to run (since it checks every row) and I have to run the code from each Sheet1 and Sheet2. Is there a way I can stay on Sheet3 (or any other sheet), click a button which runs a macro that hides rows in both Sheet1 and Sheet2 automatically? Thank you!
Current code below:
Sub Row_Hide()
BeginRow = 14
EndRow = 701
ChkCol = 2
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = 0 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
Current code below:
Sub Row_Hide()
BeginRow = 14
EndRow = 701
ChkCol = 2
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = 0 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub