Hi all,
I have the following code that was working before but now crashes and instantly closes the excel workbook whenever I click the button to run. I use the same macro on multiple sheets. Basically, if three cells added together equal zero I write "Hide" in the cell in column "O". The macro then hides all rows with "Hide" in column O. Not sure what happened to all of a sudden make this not work.
Thank you in advance for any thoughts.
I have the following code that was working before but now crashes and instantly closes the excel workbook whenever I click the button to run. I use the same macro on multiple sheets. Basically, if three cells added together equal zero I write "Hide" in the cell in column "O". The macro then hides all rows with "Hide" in column O. Not sure what happened to all of a sudden make this not work.
Thank you in advance for any thoughts.
VBA Code:
Option Explicit
Sub HideRows()
Dim i As Long, LR As Long
LR = Range("O" & Rows.Count).End(xlUp).Row
For i = 1 To LR
If Range("O" & i).Value = "Hide" Then
Rows(i).Hidden = True
Else
Rows(i).Hidden = False
End If
Next i
End Sub
Sub UnhideRows()
Rows("1:500").EntireRow.Hidden = False
End Sub