Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
get all sheet names in comboBox of activeworkbook and export when selected
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
get all sheet names in comboBox of activeworkbook and export when selected
Hello, Can you copy only a range (let's say A1:I50) on the activesheet, if needed to. Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=378269 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
get all sheet names in comboBox of activeworkbook and export when selected
it gives me debug msg when i try to copy next sheet only 1 sheet is possible with the abv code??? -- ilyaskazi ------------------------------------------------------------------------ ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969 View this thread: http://www.excelforum.com/showthread...hreadid=378269 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
get all sheet names in comboBox of activeworkbook and export whenselected
I put a combobox and two commandbuttons on a userform.
This was the code behind the userform: Option Explicit Private Sub CommandButton1_Click() Unload Me End Sub Private Sub CommandButton2_Click() Dim myVisible As Long Dim ToWkbk As Workbook Dim ToWkbkName As String Dim wksName As String Dim myWindow As Window Set myWindow = ActiveWindow ToWkbkName = "myproject.xls" If Me.ComboBox1.ListIndex < 0 Then Beep Exit Sub 'nothing selected End If Set ToWkbk = Nothing On Error Resume Next Set ToWkbk = Workbooks(ToWkbkName) On Error GoTo 0 If ToWkbk Is Nothing Then MsgBox "Please open: " & ToWkbkName & " first!" Exit Sub End If wksName = Me.ComboBox1.Value With ActiveWorkbook.Worksheets(wksName) Application.ScreenUpdating = False myVisible = .Visible .Visible = xlSheetVisible .Copy _ after:=ToWkbk.Sheets(ToWkbk.Sheets.Count) .Visible = myVisible myWindow.Activate Application.ScreenUpdating = True End With End Sub Private Sub UserForm_Initialize() Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets Me.ComboBox1.AddItem wks.Name Next wks End Sub ilyaskazi wrote: 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 -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
get all sheet names in comboBox of activeworkbook and export when selected
thankyou dave, it is exactly as wanted. : -- ilyaskaz ----------------------------------------------------------------------- ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396 View this thread: http://www.excelforum.com/showthread.php?threadid=37826 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mutiple names in ActiveWorkbook.SendMail Recipients:= | Excel Discussion (Misc queries) | |||
populate combobox with sheet names | Excel Programming | |||
populate combobox with sheet names | Excel Programming | |||
Populating sheet names in combobox | Excel Programming | |||
Using ActiveWorkbook.Names.Add Name:= | Excel Programming |