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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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