T
timmtamm
I want to make a macro that will recognize a value in a cell and then hide
rows that I don't need.
for example: cell is J20
If I put into the cell the value of "A1" then hide rows 11:20
"A2" hides rows 21:30
"B1" hides rows 11:30
and of course nothing in the cell does not hide anything.
I found a little format in the FAQ's section, but it was not very helpful. I
adusted it to try to see if it would work for me, but upon trying it, nothing
happened. Either it doesn't automatically tie itself to the cell and I have
to activate the thing or I'm not doing it right. Most likely the latter.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("J20")) Is Nothing Then
Exit Sub
Else
Rows("11:20").Select
Selection.EntireRow.Hidden = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$10"
End Sub
rows that I don't need.
for example: cell is J20
If I put into the cell the value of "A1" then hide rows 11:20
"A2" hides rows 21:30
"B1" hides rows 11:30
and of course nothing in the cell does not hide anything.
I found a little format in the FAQ's section, but it was not very helpful. I
adusted it to try to see if it would work for me, but upon trying it, nothing
happened. Either it doesn't automatically tie itself to the cell and I have
to activate the thing or I'm not doing it right. Most likely the latter.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("J20")) Is Nothing Then
Exit Sub
Else
Rows("11:20").Select
Selection.EntireRow.Hidden = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$10"
End Sub