Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Vb code help needed

I have a combobox in worksheet2= (Users) and the dynamic list=(PickerList)
for it is in worksheet3=(SetUp) . Currently i have the combobox coded so that
the current active cell value becomes the value of the combobox , if a
selection is not in the combobox the user can select the word "add" from the
list and an input box
will arrive for them to enter the non existing text. all is well and working
as intended , except for the fact i would like to know if it is possible to
get there entry in the inputbox to add itself to the dynamic list ?
Here is the code currently being used,

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.Value = res


End If
End If



End Sub
(lol)please keep in mind i'm no expert in vb code.
Thanks in advance to anyone willing to help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Vb code help needed

Use additem with no equal sign as shown below

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.additem res


End If
End If



End Sub


"Lars" wrote:

I have a combobox in worksheet2= (Users) and the dynamic list=(PickerList)
for it is in worksheet3=(SetUp) . Currently i have the combobox coded so that
the current active cell value becomes the value of the combobox , if a
selection is not in the combobox the user can select the word "add" from the
list and an input box
will arrive for them to enter the non existing text. all is well and working
as intended , except for the fact i would like to know if it is possible to
get there entry in the inputbox to add itself to the dynamic list ?
Here is the code currently being used,

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.Value = res


End If
End If



End Sub
(lol)please keep in mind i'm no expert in vb code.
Thanks in advance to anyone willing to help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Vb code help needed

I tried this , but get an Run-time error"70", permission denied . My dynamic
list name range is typed in as this
=OFFSET(SetUp!$A$1,0,0,CountA(SetUp!$A:$A),1)
I think this is the correct way in order to let the list grow as name's are
added.
Not sure why i'm getting permission denied.

"Joel" wrote:

Use additem with no equal sign as shown below

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.additem res


End If
End If



End Sub


"Lars" wrote:

I have a combobox in worksheet2= (Users) and the dynamic list=(PickerList)
for it is in worksheet3=(SetUp) . Currently i have the combobox coded so that
the current active cell value becomes the value of the combobox , if a
selection is not in the combobox the user can select the word "add" from the
list and an input box
will arrive for them to enter the non existing text. all is well and working
as intended , except for the fact i would like to know if it is possible to
get there entry in the inputbox to add itself to the dynamic list ?
Here is the code currently being used,

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.Value = res


End If
End If



End Sub
(lol)please keep in mind i'm no expert in vb code.
Thanks in advance to anyone willing to help

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Vb code help needed

I would use a worksheet_change functtion. When items are added in sheet 3
have the worksheet_change function add the item to the combobox.

"Lars" wrote:

I tried this , but get an Run-time error"70", permission denied . My dynamic
list name range is typed in as this
=OFFSET(SetUp!$A$1,0,0,CountA(SetUp!$A:$A),1)
I think this is the correct way in order to let the list grow as name's are
added.
Not sure why i'm getting permission denied.

"Joel" wrote:

Use additem with no equal sign as shown below

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.additem res


End If
End If



End Sub


"Lars" wrote:

I have a combobox in worksheet2= (Users) and the dynamic list=(PickerList)
for it is in worksheet3=(SetUp) . Currently i have the combobox coded so that
the current active cell value becomes the value of the combobox , if a
selection is not in the combobox the user can select the word "add" from the
list and an input box
will arrive for them to enter the non existing text. all is well and working
as intended , except for the fact i would like to know if it is possible to
get there entry in the inputbox to add itself to the dynamic list ?
Here is the code currently being used,

Private Sub ComboBox1_Change()
ActiveCell.Value = ComboBox1.Value
If ComboBox1.Value = "Add" Then
res = InputBox("ADD NAME")
If res < "" Then
ComboBox1.Value = res


End If
End If



End Sub
(lol)please keep in mind i'm no expert in vb code.
Thanks in advance to anyone willing to help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code needed ernie New Users to Excel 1 March 19th 10 12:45 PM
vb code help needed Phil Excel Programming 4 January 10th 07 04:21 AM
Help Please - last bit of code needed Mark Dullingham Excel Programming 4 May 6th 06 12:33 AM
VBA code help needed Martin Excel Discussion (Misc queries) 3 April 28th 06 09:28 AM
Fw:code needed ibo Excel Programming 2 August 5th 03 09:30 PM


All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"