Refreshing a listbox
The sheet that contains the listbox is named 'Home'
The listbox name is 'Listbox1'
The sheet that contains the datarange for the listbox is named 'Current DB'
The name of the data range is 'wrkshtrng'
I noticed that when I ran the code you suggested in the earlier posts
Sheets("Home").OLEObjects("Listbox1").ListFillRang e =
Range("wrkshtrng").address
The range for the ListFillRange changed to $D$6:$D$7 which is in the sheet
that contains the listbox. Not the sheet that contains the datarange.
So I tried
Sheets("Home").OLEObjects("ListBox1").ListFillRang e = sheets("Current
DB").Range("wrkshtrng").Address
I got the same results. How do I get the address to be in the right
worksheet?
"Joel" wrote:
See earlier posting the answer is
Sheets("Home").OLEObjects("ListBox1").ListFillRang e = _
Mid(Names("wrkshtrng").Value, 2)
Using Range("rng").address doesn't include the sheet name. The only way of
getting the sheet name is using names, but names include an equal sign at the
beginning. the MID removes the equal sign.
"ranswrt" wrote:
I have been stumped with a listbox added to a worksheet using the control
toolbox. I have been having problems refreshing the listbox when the data
range is changed. I have been using the following code to refresh it:
Sheets("name").OLEObjects("Listbox1").ListFillRang e = Range("rng").address
I have been getting a blank listbox. I can manually enter the range in the
property window for the listfillrange, but when the range is changed the
listbox isn't updated. Is there a better way to update the listbox?
Thanks
|