VBA dropdown list

Kristina96

New Member
Joined
Sep 30, 2019
Messages
33
Hello everyone,

I want to add a dropdown list to a selection of cells. My code is adding a dropdown list to the cell but the list contains all the option as one. Meaning that instead of giving the chance to choose either option 1, option 2 or option 3 it gives only one option called "option 1; option 2; option 3".
My code:
Code:
With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="option 1; option 2; option 3"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = "Title"
        .ErrorTitle = ""
        .InputMessage = _
        "Test message" & Chr(10) & ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

Thank you in advance
Kristina
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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