![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Sure, but that depends on how is it "tied"
|
|
|
|
|
|
#3 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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 |
|
|
|
|
|
#4 |
|
New Member
Join Date: Apr 2002
Posts: 26
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|