Help with hiding rows based on cell criteria

=HPSF=RMP

Board Regular
Joined
Jun 9, 2004
Messages
188
I've searched far and wide. I'm close, but can't get it to work.


Here is my code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("n1")) Is Nothing Then
  Exit Sub
 Else
 Application.ScreenUpdating = False
 Application.Calculation = xlCalculationManual
Rows("8:28").Hidden = True
    Select Case Range("n1").Value
     Case "1"
     Rows("8:12,16:28").Hidden = False
     Case "2"
     Rows("8:10,12:19,22:28").Hidden = False
     Case "3"
     Rows("9:10,12,16,18:28").Hidden = False
     Case "4"
     Rows("9:10,12:16,18:19,22:28").Hidden = False
End Select
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

I have a formula in N1 that will give me a number from 1-5.
I want to reveal rows based on the result of the formula in N1.
the forumla in N1 is:
Code:
=IF(L1="Inbound ",1,IF(L1="Inbound 3rd Party",2,IF(L1="Outbound ",3,IF(L1="Outbound 3rd Party",4,5))))

The formula for L1 is a concantination of two other cells:
Code:
=F3&" "&J1

Hope this makes sense.
Any help on this would be great thanks
 
The macro is running, but it doesn't seem to work... Getting a Run-time error '-2147417848 (80010108)
Method 'Hidden' of object 'Range' failed.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,225,155
Messages
6,183,208
Members
453,151
Latest member
Lizamaison

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top