Regarding drop down list

Otiose2

New Member
Joined
Apr 12, 2018
Messages
9
Hi All,

I have a drop down list having this data:

Slider
Turn
Hand
Flex
None

My query is If I select Either Slider/Turn/Hand/Flex than next cell should have drop down list having sub categories as follows.

For Slider - D4V1, D4V2, D4V3, D4V4
For Turn - S2V1, S2V2, S2V3, S2V4
For Hand - T2V1, T2V2, T2V3, T2V4
For Flex - F2V1, F2V2, F2V3, F2V4

And If I select None than next cell should fill None automatically. I do not want dropdown in case of None selection.

Thanks in advance for your support.
 
The reason your are getting the "Ambiguous name detected" error is because you can have only one "Worksheet_Change" macro in a sheet. I have tidied up the code a bit and combined the two macros into one. Give this a try:
Code:
 Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B13,B38")) Is Nothing Then Exit Sub
    If Target.Address = "$B$13" Then
        Select Case Target.Value
            Case "None"
                With Range("B14:B15")
                    .Validation.Delete
                    .Value = "None"
                End With
            Case "Servo Gun Axis"
                Range("B14:B15").ClearContents
                With Range("B14").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Servo"
                End With
            Case "Slider Axis"
                Range("B14:B15").ClearContents
                With Range("B14").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Slider"
                End With
            Case "Turntable Axis"
                Range("B14:B15").ClearContents
                With Range("B14").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Turntable"
                End With
            Case "Flex Hand"
                Range("B14:B15").ClearContents
                With Range("B14").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Flex"
                End With
        End Select
    ElseIf Target.Address = "$B$38" Then
        Select Case Target.Value
            Case "None"
                With Range("B39:B45")
                    .Validation.Delete
                    .Value = "None"
                End With
            Case "Select from Below"
                Range("B39:B45").ClearContents
                With Range("B39").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="AC 380V,AC 400V,None"
                End With
                With Range("B40").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Input 2CH:Output 4CH, None"
                End With
                With Range("B41").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Built In Function , None"
                End With
                With Range("B42").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Differential Input , None"
                End With
                With Range("B43").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Flex, None"
                End With
                With Range("B44").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="ATI , Series, None"
                End With
                With Range("B45").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Sensor unit, None"
                End With
        End Select
    End If
 End Sub
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,847
Messages
6,181,314
Members
453,032
Latest member
Pauh

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