View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA for opening file/populating combo box with sheet names

Hi Sinobato,

Okay, once you have opened the workbook, this code will get the sheet names
and store them in a sheet called Hidden in column A

i=0
For Each sh In Activworkbook.Worksheets
i=i+1
Worksheets("Hidden").Range("A" & i).Value = sh.Name
Next i

To link the combox to the range use


With ActiveSheet.ComboBox1
.ListFillRange = "Hidden!" & "A1:A" & i
.ListIndex = 0
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sinobato " wrote in message
...
Bob,

Thanks for the information! However, can you give me a sample code of
how I can get the sheet names from workbook? I don't have an idea how
can I iterate through the sheets on the workbook and get the names.

Thanks again!
Sinobato


---
Message posted from http://www.ExcelForum.com/