Adding Items to Dropdown list

music_al

Board Regular
Joined
Nov 26, 2008
Messages
133
How do I add an item to a drop down box ?

I know how to (with a loop) to get the individual items (strings) but I dont know how to add them.


thanks in advance

Al
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Do you mean a DataValidation list?
Or A Activex Combobox

So are you saying you have some values already in the list and want to add more automatically?
Or explain more.
 
Upvote 0
If your saying you want a DataValidation list where you can keep adding values too here is what I do:

Create a Excel Table one column wide
Enter a few values in the Table rows

I select the column where I wanted my DataValidation list.


Then in the DataValidation Dialog Box I choose List then I choose all the current rows in my Table. As I add to the Table There are more row values added to the DataValidation List.
My Table is only one column wide


I'm using Excel 2013
 
Upvote 0
How do I add an item to a drop down box ?

I know how to (with a loop) to get the individual items (strings) but I dont know how to add them.

So it sounds like you want to add data validation to a cell using vba. The following might get you started...

Code:
Sub Macro1()
Dim lyst As String, i As Long
''''Loop to create list
For i = 1 To 5
    If lyst <> "" Then
        lyst = lyst & "," & Cells(i, 1)
    Else
        lyst = Cells(i, 1)
    End If
Next i

''''The code below was created with the Macro Recorder
''''Add data validation; modify Formula1 to the list you just created
With Range("N1").Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
    xlBetween, Formula1:=lyst
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
End With
End Sub

Cheers,

tonyyy
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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