Adding Items To A Listbox

camalita

New Member
Joined
Apr 8, 2002
Messages
26
I have a listbox which is tied to a list in a worksheet. Is there anyway a user can add an item without adding it to the list.

Thanks for the help

Mareene
 

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.
Hi Mareene

You could use some code like this:

Code:
Dim strRange As String

Private Sub UserForm_Initialize()
Dim rcell As Range

  strRange = Me.ListBox1.RowSource
  Me.ListBox1.RowSource = ""

        For Each rcell In Range(strRange)
            ListBox1.AddItem rcell
        Next rcell
  ListBox1.AddItem "NotInList"

End Sub


When you wish to set the ListBox back to it's RowSource just use:

Me.ListBox1.RowSource = strRange
 
Upvote 0
It was an oversight on my part not to mention that my dropdown list has 2 columns. This list is the name of banks with codes for each bank. I have the list in a1:b200 The codes run in alphabetical order, starting with A0:AZ for each branch of a particular bank and then on to B0 etc. in Column A and Column B has the bank description. The code makes the dropdown list blank. Is there any way to add the code and description of the bank without having to amend the list I have in another worksheet? The users that will be using this form will be at a different office - Overseas to be exact- so that means I will have to keep sending updated versions.

Mareene
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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