View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_175_] joel[_175_] is offline
external usenet poster
 
Posts: 1
Default Populate sheet names in a listbox


The code below assumes you have a listbox on the worksheet that was
added from the Toolbars - Forms

Sub test()

fileToOpen = Application _
.GetOpenFilename("Excel Files (*.xls), *.xls")
If fileToOpen = False Then
MsgBox ("Cannot Open file - Exiting Macro")
Exit Sub
End If
For Each sht In Sheets
ActiveSheet.ListBoxes("List Box 2").AddItem sht.Name
Next sht


End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=150774

Microsoft Office Help