Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How does this work if you have multiple worksheets?
Your code works if you only have one, but when you add the worksheets reference the resource no longer updates! Paul Smith "Bob Phillips" wrote in message ... Paul, This worked for me Private Sub CommandButton1_Click() ActiveWorkbook.Names.Add Name:="range_name", RefersTo:="=A1:A5" Me.ListBox1.RowSource = Range("range_name").Address End Sub Private Sub UserForm_Initialize() Me.ListBox1.RowSource = Range("range_name").Address End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Paul W Smith" wrote in message ... The rowsource is set at run-time, and works fine until an event on the userform causes an update to the rowsource. It seems I have to physically make a large change to the scroll bar to make the listbox xhnage to reflect the change of it's rowsource. PWS "Bob Phillips" wrote in message ... If that code is executed outwith the form, all you need to do is set the rowsource property on the userform initialize event Listbox1.RowSource = Range("range_name").Address as it is a string property. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Paul W Smith" wrote in message ... On a user form I have a listbox that I am populating by having set it's rowsource to a range on a named range worksheet. I have actions which are run from the userform which add or subtract entries from this named range. I have code which changes the named range when new items need to be added/subtracted and this works. However what do I have to do to have the listbox updated. It seems to me that I have to physically move the scroll bar of the listbox to have the changes recognised. PWS |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Listbox rowsource on Userform | Excel Discussion (Misc queries) | |||
RowSource in ListBox | Excel Programming | |||
RowSource in ListBox | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
listbox rowsource | Excel Programming |