B
brownti via OfficeKB.com
I have an IF statement with two condtions as noted below. I want it to work
so that if column G has a y in it, it will be hidden, and also if column G
has an N in it and column O has a 0 then it will be hidden. The second part
doesnt work. Any thoughts?
Sub Hide_new()
Dim cell As Range
Dim rngisect As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set rngisect = Application.Intersect(ActiveSheet.UsedRange, Range("G19:
G4061"))
For Each cell In rngisect
If cell.Value = "Y" Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = "N" And cell.Offset(8).Value = "0" Then
cell.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
so that if column G has a y in it, it will be hidden, and also if column G
has an N in it and column O has a 0 then it will be hidden. The second part
doesnt work. Any thoughts?
Sub Hide_new()
Dim cell As Range
Dim rngisect As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set rngisect = Application.Intersect(ActiveSheet.UsedRange, Range("G19:
G4061"))
For Each cell In rngisect
If cell.Value = "Y" Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = "N" And cell.Offset(8).Value = "0" Then
cell.EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub