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: 1
Default Looping to fill ListBox


I have assigned a macro to commandbutton whose job is to populate a
ListBox with data from varying ranges from each sheet in a workbook.
(For this purpose, the ColumnCount is conservatively set to 8). It may
sound a bit weird for anyone to attempt to do this but the object is to
create a palpable visual effect of the process of filling the box. How
do I achieve this looping through the sheets -but without activating
them-? The code below treads water at the activesheet and fails to
loop.

Private Sub CommandButton1_Click()
For Each sh In Worksheets
Set rng = sh.Range("a1:f" & sh.[a65536].End(xlUp).Row)
ListBox1.RowSource = rng.Address
Next sh
End Sub

Thanks

David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=498026

 
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
Unable to fill Listbox thru VBA rash Excel Programming 6 December 20th 05 01:51 PM
Looping through listbox controls Vince Excel Programming 11 April 12th 05 04:40 PM
Is there an easier way to fill this listbox D[_8_] Excel Programming 3 December 31st 04 04:38 PM
For..next.. help to fill listbox jasonsweeney[_69_] Excel Programming 1 April 20th 04 09:25 PM
Excel VBA-Looping though MultiSelect on ListBox jpendegraft[_3_] Excel Programming 2 February 3rd 04 04:38 PM


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