View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Populate a list box with all active workbooks except the current one.

this is for listbox1 on a userform:

Private Sub UserForm_Activate()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < ActiveSheet.Name Then
Me.ListBox1.AddItem ws.Name
End If
Next
End Sub

--


Gary

"travis" wrote in message
...
Hi,

I'm not sure how to go about this one...

I want a listbox control in a userform launched from
spreadsheetone.xls to display the names of all the other
spreadsheets. i.e. the user can select any workbook in the open
workbooks collection, but spreadsheetone.xls won't be in that list
(because the form is part of an exporting routine to copy charts and
tables from spreadsheetone.xls to a new worksheet in whichever open
workbook the user selects).

How do I put the names of all open workbooks into a listbox?

Travis