View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default get all sheet names in comboBox of activeworkbook and export when selected

Following code lists all sheets in activeworkbook in combobox1, if user
chooses a sheet it is copied into the MyProjects.xls at the end.
Hopefully gives you a starter for 10. Place code behind the userform.

Option Explicit
Dim ws As Integer

Private Sub ComboBox1_Change()
Worksheets(ComboBox1.Value).Copy
After:=Workbooks("MyProjects.xls").Sheets(Sheets.C ount)
End Sub

Private Sub UserForm_Initialize()
For ws = 1 To Worksheets.Count
ComboBox1.AddItem Worksheets(ws).Name
Next
End Sub

--
Cheers
Nigel



"ilyaskazi" wrote
in message ...

get all sheet names (even hidden or very hidden sheets) in comboBox of
the activeWorkbook upon loading Userform.

If the specific sheet is selected then export that sheets in already
opened workbook(MyProject.xls) when 'cmdImport' button is clicked.


--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile:

http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=378269