Copy the Workbook from userform i.e, load the workbook path and copy the output workbook path

mahaboobk

New Member
Joined
Oct 12, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Web
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
 

Attachments

  • submit.JPG
    submit.JPG
    20.1 KB · Views: 2

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

mahaboobk

New Member
Joined
Oct 12, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Web
please check the screen shot "Get and submit"
 

Attachments

  • Get and submit.JPG
    Get and submit.JPG
    34.4 KB · Views: 0

Watch MrExcel Video

Forum statistics

Threads
1,118,656
Messages
5,573,438
Members
412,529
Latest member
cTatch
Top