J
jat
i have a worksheet that i want to hide rows based on cell value.
if cell B3 is blank, then i need rows 4,5 and 6 to be hidden, B3 contains
data than row 4 is visible.
if cell H3 is blank, then rows 5 and 6 need to be hidden. if b3 and h3 have
data, then rows 4 and 5 are visible.
if cell n3 is blank then row 6 is hidden.
i have the following so far:
Private Sub Worksheet_change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "P28" Then
Select Case LCase(Target.Value)
Case "target": MainMenu 'this brings up a user input box and works
End Select
End If
If Target.Address(0, 0) = "B3" Then
If Range("B3") <> "" Then Call hideum
End If
Application.EnableEvents = True
End Sub
<
--
Sub hideum()
Dim i As Long
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
If Cells(i, 1).Value = "XXX" Then
Rows(i).Hidden = True
End If
Next
End Sub
i can run the hideum macro manually but it does not fire on it's own. any
suggestions?
if cell B3 is blank, then i need rows 4,5 and 6 to be hidden, B3 contains
data than row 4 is visible.
if cell H3 is blank, then rows 5 and 6 need to be hidden. if b3 and h3 have
data, then rows 4 and 5 are visible.
if cell n3 is blank then row 6 is hidden.
i have the following so far:
Private Sub Worksheet_change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(0, 0) = "P28" Then
Select Case LCase(Target.Value)
Case "target": MainMenu 'this brings up a user input box and works
End Select
End If
If Target.Address(0, 0) = "B3" Then
If Range("B3") <> "" Then Call hideum
End If
Application.EnableEvents = True
End Sub
<
--
Sub hideum()
Dim i As Long
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
If Cells(i, 1).Value = "XXX" Then
Rows(i).Hidden = True
End If
Next
End Sub
i can run the hideum macro manually but it does not fire on it's own. any
suggestions?