Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default combo box not updating

Hi.

I'm using a combobox to display a parts list. In the
spreadhseet, there is a range named rgParts, and in the
code, there is a range variable anmed rgParts .

When a part is added, the spreadsheet range name is being
expanded, and the code range variable is being reassigned.

Yet, the parts list displayed in the combo box does not
display the new part until the form has been unloaded and
reloaded.

Is there a way to refresh the list displayed in the
combobox without unloading and reinitializing the form?

Thanks.
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default combo box not updating

Mark

If you have the combobox directly in the spreadsheet from
the control toolbox (ie not on a form which is loaded),
then you can easily have it updated.

Have the part names in a named range which is dynamically
updated. Link the combobox to the named range. Right
click on the sheet tab, select view code and insert the
following in the worksheet change event

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
ComboBox1.ListFillRange = "validnames"
End Sub

This will update the combobox with the updated range
listing.

Tony
-----Original Message-----
Hi.

I'm using a combobox to display a parts list. In the
spreadhseet, there is a range named rgParts, and in the
code, there is a range variable anmed rgParts .

When a part is added, the spreadsheet range name is being
expanded, and the code range variable is being reassigned.

Yet, the parts list displayed in the combo box does not
display the new part until the form has been unloaded and
reloaded.

Is there a way to refresh the list displayed in the
combobox without unloading and reinitializing the form?

Thanks.
Mark
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default combo box not updating

Thanks for the suggestion, but the list box is in a form.

I would have thought the rowsource property might have
updated it dynamically each time that the drop box button
is pressed, but apparently, I would have thought wrong.


-----Original Message-----
Mark

If you have the combobox directly in the spreadsheet from
the control toolbox (ie not on a form which is loaded),
then you can easily have it updated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default combo box not updating

Thanks for the suggestion, but the list box is in a form.


I really want the listbox in a form, not in the
spreadsheet itself, so I have had the 'Add Part' button
call a code module which unloads and reloads the form...
which in turn is repopulating the list box as desired.

In this specific application, that happens so quickly that
it is not even detectible to the eye, but if anyone knows
of a better way to do it, I'd still be happy to know.

Thanks.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default combo box not updating

Mark

One option that you have is to make a separate sub in your Userform code
module like this

Private Sub MyInit()

'do initialize stuff here including setting the RowSource property

End Sub

Then in the Initialize event, call this sub

Private Sub UserForm_Initialize()

MyInit

End Sub

Then in your AddPart_Click event, you can call MyInit that will essentially
reinitialize the form without closing and reopening it.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"mark" wrote in message
...
Thanks for the suggestion, but the list box is in a form.



I really want the listbox in a form, not in the
spreadsheet itself, so I have had the 'Add Part' button
call a code module which unloads and reloads the form...
which in turn is repopulating the list box as desired.

In this specific application, that happens so quickly that
it is not even detectible to the eye, but if anyone knows
of a better way to do it, I'd still be happy to know.

Thanks.





  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default combo box not updating

ok. thanks.


-----Original Message-----
Mark

One option that you have is to make a separate sub in

your Userform code
module like this


Private Sub MyInit()

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
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM
When updating a worksheet, how do I create a link updating the sa. Phlashh Excel Worksheet Functions 9 January 27th 05 06:05 PM


All times are GMT +1. The time now is 05:23 AM.

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

About Us

"It's about Microsoft Excel"