Two codes - Private Sub Worksheet_Change(ByVal Target As Range)

jdmchic00

New Member
Joined
May 18, 2020
Messages
6
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi!
I have a question. How can I get two codes to run on the same sheet????


Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("B4"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "All": Rows("14:22").EntireRow.Hidden = True
Rows("8:13").EntireRow.Hidden = False
Case Is = "Kelsey Lopez": Rows("14:22").EntireRow.Hidden = False
Rows("8:13").EntireRow.Hidden = True
End Select

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("B52"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "Advanced Stage": Rows("60:62").EntireRow.Hidden = False
Rows("58:59").EntireRow.Hidden = True
Case Is = "Early Stage": Rows("58:59").EntireRow.Hidden = False
Rows("60:62").EntireRow.Hidden = True
Case Is = "Total Open Pipeline": Rows("58:62").EntireRow.Hidden = False

End Select
End If
End Sub



Thanks!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Application.Intersect(Range("B4"), Target) Is Nothing Then
      Select Case Target.Value
         Case "All"
            Rows("14:22").EntireRow.Hidden = True
            Rows("8:13").EntireRow.Hidden = False
         Case "Kelsey Lopez"
            Rows("14:22").EntireRow.Hidden = False
            Rows("8:13").EntireRow.Hidden = True
      End Select
   ElseIf Not Application.Intersect(Range("B52"), Target) Is Nothing Then
      Select Case Target.Value
         Case "Advanced Stage"
            Rows("60:62").EntireRow.Hidden = False
            Rows("58:59").EntireRow.Hidden = True
         Case "Early Stage"
            Rows("58:59").EntireRow.Hidden = False
            Rows("60:62").EntireRow.Hidden = True
         Case "Total Open Pipeline"
            Rows("58:62").EntireRow.Hidden = False
      End Select
   End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,533
Messages
6,120,076
Members
448,943
Latest member
sharmarick

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