View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Refreshing a listbox

Does this test code get the correct worksheet?

Sub test()

With Sheets("current db")
Set xcell = .Range("B4")
num = 10
.Range(xcell.Offset.Offset(1, 0), _
xcell.Offset(num, 0)).Name = "wrkshtrng"
End With

a = Mid(Names("wrkshtrng").Value, 2)


End Sub


"ranswrt" wrote:

I just noticed that the address that is being put into the listfillrange
property from the code that I am using is from the same sheet. The
datarange is on a different sheet that the listbox.

I tried:

Sheets("name").OLEObjects("Listbox1").ListFillRang e =
sheets("data").Range("rng").address

I still get the same results

"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