Hello All
Hopefully one of you awesome excel experts can help...
I have to create a userform with Commandbutton to navigate on (Get workbook path) selecting the "Abc" excel workbook, it should copy with all the sheets that are available in "Abc" workbook and paste that in different path as "Abc" workbook name (Put workbook path)
1. Source of "Abc" should be selcted from commandbutton
2. destination of "Abc" should be given code path
3. click submit button
-------------------------------------------------------------------
I the below code has issue but have included it below. Its got messup
Sub Get_copy_sheets_Click()
Dim fileToOpen As Variant
Dim wb As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If fileToOpen <> False Then
Set wb = Application.Workbooks.Open(fileToOpen)
'wb.Sheets(1).Range("A1:E20").Copy
'ThisWorkbook.Worksheets("SelectFile").Range("A10").PasteSpecial xlPasteValues
wb.Close False
Set wb = Application.Workbooks.GetOpenFilename
wb.Activate
ActiveWorkbook.Sheets("Any worksheet name or index").Copy
ActiveWorkbook.SaveAs "Path to the file"
ActiveWindow.Close
wb.Close
msgBox ("successfully copyed")
End Sub
Hopefully one of you awesome excel experts can help...
I have to create a userform with Commandbutton to navigate on (Get workbook path) selecting the "Abc" excel workbook, it should copy with all the sheets that are available in "Abc" workbook and paste that in different path as "Abc" workbook name (Put workbook path)
1. Source of "Abc" should be selcted from commandbutton
2. destination of "Abc" should be given code path
3. click submit button
-------------------------------------------------------------------
I the below code has issue but have included it below. Its got messup
Sub Get_copy_sheets_Click()
Dim fileToOpen As Variant
Dim wb As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If fileToOpen <> False Then
Set wb = Application.Workbooks.Open(fileToOpen)
'wb.Sheets(1).Range("A1:E20").Copy
'ThisWorkbook.Worksheets("SelectFile").Range("A10").PasteSpecial xlPasteValues
wb.Close False
Set wb = Application.Workbooks.GetOpenFilename
wb.Activate
ActiveWorkbook.Sheets("Any worksheet name or index").Copy
ActiveWorkbook.SaveAs "Path to the file"
ActiveWindow.Close
wb.Close
msgBox ("successfully copyed")
End Sub