#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default listbox

I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the listfillrange
so that the new items are added to the listbox. I used the following code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default listbox

Hi Ranswrt,

The ListFillRange property requires a string
representing an address.

If wrkshtrg is a range variable, try something
like:

Sheets("Home").Shapes("ListBox1").ListFillRange = _
wrkshtrng.Address

If is a named range, try:

Sheets("Home").Shapes("ListBox1").ListFillRange = _
Range(wrkshtrng).Address



---
Regards,
Norman


"ranswrt" wrote in message
...
I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the
listfillrange
so that the new items are added to the listbox. I used the following
code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default listbox


Sheets("Home").OLEObjects("ListBox1").ListFillRang e = _
Range("wrkshtrng").Address
"ranswrt" wrote:

I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the listfillrange
so that the new items are added to the listbox. I used the following code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default listbox

I would be specific where that range exists:

.... range("wrkshtrng").address(external:=true)



Joel wrote:

Sheets("Home").OLEObjects("ListBox1").ListFillRang e = _
Range("wrkshtrng").Address
"ranswrt" wrote:

I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the listfillrange
so that the new items are added to the listbox. I used the following code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default listbox

I tried the code that you suggested and it wouldn't work. I changed it to:
Sheets("Home").OLEObjects("ListBox1").ListFillRang e = "wrkshtrng"
and that worked except the listbox showed the gridlines from the range and
wouldn't show the scroll bar until I scrolled the worksheet with my mouse
scroll. The listrange is on another worksheet from the listbox. Also the
listbox wouldn't show the last item in the range. Any ideas what I can do?
"Joel" wrote:


Sheets("Home").OLEObjects("ListBox1").ListFillRang e = _
Range("wrkshtrng").Address
"ranswrt" wrote:

I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the listfillrange
so that the new items are added to the listbox. I used the following code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default listbox

I not familar with all the options in a listbox. I think you have some
option set that I'm not familar with. Try adding a new listbox and see if
the same problem occurs. Then compare the properties of the two listboxes.

to see the properties of the list box you need to go into design mode.

1) Add control toolbox toolbar to the worksheet
2) Press the Triangle. the Triangle is a toggle option that switches you in
and out of design mode
3) right click Listbox and select properties.
4) Change options manually. Any option in the properties window can be
changes using VBA code.

When you are done press the triangle again to exit design mode and retry the
code.

View - Toolbars - Control Toolbox

"ranswrt" wrote:

I tried the code that you suggested and it wouldn't work. I changed it to:
Sheets("Home").OLEObjects("ListBox1").ListFillRang e = "wrkshtrng"
and that worked except the listbox showed the gridlines from the range and
wouldn't show the scroll bar until I scrolled the worksheet with my mouse
scroll. The listrange is on another worksheet from the listbox. Also the
listbox wouldn't show the last item in the range. Any ideas what I can do?
"Joel" wrote:


Sheets("Home").OLEObjects("ListBox1").ListFillRang e = _
Range("wrkshtrng").Address
"ranswrt" wrote:

I have a listbox that I added to a worksheet. I also have a procedure that
adds items to the range for the listbox. I need to update the listfillrange
so that the new items are added to the listbox. I used the following code:
Sheets("Home").Shapes("ListBox1").ListFillRange = "wrkshtrng"
This doesn't seem to be working. What am I doing wrong?
Thanks

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
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
avoiding duplicates in listbox (added from another listbox) KR Excel Programming 4 March 14th 06 08:17 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 10:49 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"