I have a spread sheet with several sheets. I want to --From another excel file-- get all the sheet names and list them in a combo box via a macro. Is this possible?
Hasit,
Here is how I did it....May not be the best way or
a way to share...
but it works.
Sub OK_Click()
Dim sht()
File = FilenameBox.Value + ".xls"
Workbooks.Open FileName:=File
ActiveWindow.WindowState = xlMinimized
Workbooks(File).Activate
i = 0
For Each wks In Worksheets
ReDim sht(i)
sht(UBound(sht)) = i
i = i + 1
Next wks
a = 0
For Each ws In Worksheets
sht(a) = ws.Name
a = a + 1
Next ws
Workbooks(File).Close SaveChanges:=True
y = 0
For Each Item In sht
ComboBox1.AddItem sht
y = y + 1
Next Item
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.