Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ListBox Populate and Refresh

Hi there,

I want to populate a listbox from a range with a varying number of
cells that are downloaded using a webquery. I've set this up
referencing the range by name in the listbox properties but am having a
few problems. These a

1. The items do not refresh unless I change sheets - when I return to
the listbox sheet, the contents have updated.

2. The number of items in the listbox does not refresh with the number
of cells in the named range.

Can anyone help with this?

The listbox is currently an object in my worksheet but not a userform.
Is it essential for a listbox to be contained in a userform to work?

Apologies if these are daft newbie questions. I haven't used listboxes
in excel before!

Thanks heaps in advance.
Ciaran

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ListBox Populate and Refresh



wrote in message
oups.com...
Hi there,

I want to populate a listbox from a range with a varying number of
cells that are downloaded using a webquery. I've set this up
referencing the range by name in the listbox properties but am having a
few problems. These a

1. The items do not refresh unless I change sheets - when I return to
the listbox sheet, the contents have updated.


What do you mean by Refresh? Do you have any Worksheet_Activate code?

2. The number of items in the listbox does not refresh with the number
of cells in the named range.


Assuming that you are using a dynamic range, you could worksheet change
event code to update it

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "Test"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.ListBox1.ListFillRange = "=Test"
End If

ws_exit:
Application.EnableEvents = True
End Sub


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
Populate a ListBox JB in Kansas Excel Programming 6 September 19th 05 03:01 PM
populate listbox? Alen32 Excel Programming 2 June 4th 05 01:18 PM
Populate and refresh MaBell Excel Programming 4 December 13th 04 09:07 PM
Populate listBox Hamster Excel Programming 1 September 17th 03 01:14 PM
ListBox Populate Rod Taylor Excel Programming 3 July 22nd 03 12:11 AM


All times are GMT +1. The time now is 10:58 PM.

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"