Can someone please tell me what I am doing wrong? I want to hide columns based on the values found in 2 different cells, but I can't seem to get it right. Below is my current attempt... thanks for looking.
Code:
Sub Hide0DollarColumns()
Dim GLvalue As String
Dim RVU As String
For Each r In Range("L10:BA10")
If (r.Value = 0 Or r.Value = "") Then
GLvalue = "Hide"
Else: GLvalue = "UnHide"
End If
Next
For Each r In Range("L10:BA10")
If (r.Offset(5, 0).Value = "OOR" Or r.Offset(5, 0).Value = "(blank)" Or r.Offset(5, 0).Value = "" Or IsNull(r.Offset(5, 0)) = True) Then
RVU = "UnHide"
Else: RVU = "Hide"
End If
Next
For Each r In Range("L10:BA10")
If (GLvalue = "Hide" And RVU = "Hide") Then
r.EntireColumn.Hidden = True
Else: r.EntireColumn.Hidden = False
End If
Next