Worksheet Change: Multiple target values not working

Status
Not open for further replies.

vipin30sep

New Member
Joined
Feb 14, 2019
Messages
20
Hello,

I have a two dropdown based cells (C4 and C23) that have some values. Based on the selected dropdown condition, I need to hide/ unhide certain rows in another sheet (written macros for it). I'm using the following code, but only one works at a time. Could you please help as I'm stuck. Appreciate your help. Thanks!


Code:
Private Sub Worksheet_Change(ByVal Target As Range)




If Not Intersect(Target, Range("C4,C23")) Is Nothing Then
    Select Case Target.Address(0, 0)
    Case "C4"
        If Target.Value = "Ecommerce" Then Call Ecommerce
        If Target.Value = "Non-Commerce" Then Call NonCommerce
        If Target.Value = "Ecommerce & Non-Commerce" Then Call Both
        If Target.Value = "Select Ecommerce/Non-Commerce" Then Call Both
        
    Case "C23"
        If Target.Value = "Select Year" Then Call SelectYear
        If Target.Value = "2020" Then Call Twentytwenty
        If Target.Value = "2021" Then Call TwentyOne
        If Target.Value = "2022" Then Call TwentyTwo
        If Target.Value = "2023" Then Call TwentyThree
        If Target.Value = "2024" Then Call TwentyFour
        If Target.Value = "2025" Then Call TwentyFive
                            
    End Select
End If
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Status
Not open for further replies.

Forum statistics

Threads
1,215,222
Messages
6,123,706
Members
449,118
Latest member
MichealRed

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