LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default ListFillRange

I have a ListBox object (from Controls toolbar) in Sheet1. The ListFillRange
property is a defined range named 'MyRange' (located in Sheet2). 'MyRange' is
dynamic. It changes in length according to some calculations. I want the
ListBox items to change accordingly. I'm using the following code to first
set the ListFillRange to nothing then set it to MyRange. However, the list
doesn't get refreshed straight away. The list items get updated only when i
manually activate a different worksheet then go back to Sheet1. How can i fix
that? is there such a thing as 'refreshing' the listbox programatically? i'm
using Excel 2003
Here is my code:

' delete the old range
ActiveWorkbook.Names("MyRange").Delete

[code to do some calculations]

' give the new range the same name
Sheets("Sheet2").Range("A5:B5").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:="MyRange", RefersTo:=Selection

Sheets("Sheet1").activate

' assigning the newly named range to the listbox
Worksheets("Sheet1").OLEObjects("ListBox2").ListFi llRange = ""
Worksheets("Sheet1").OLEObjects("ListBox2").ListFi llRange = "MyRange"

exit sub

Everything goes fine except that the listbox doesn't show the new items
directly. Why do i have to log out of Sheet1 then go back to find the new
results in the listbox?
Any help will be greatly appreciated.
Cheers, Tendresse


 
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
ListFillRange ranswrt Excel Programming 7 July 19th 08 11:59 AM
ListFillRange challenge Steve C Excel Programming 6 February 10th 06 03:47 PM
ListFillRange not working Jeff Excel Programming 2 July 1st 05 03:36 PM
ListFillRange Dave Baranas Excel Programming 0 August 12th 03 05:09 AM
ListFillRange Dave Baranas Excel Programming 1 August 11th 03 11:08 PM


All times are GMT +1. The time now is 08:26 AM.

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"