Copy worksheet from other workbook based on cell value (path & sheetname)

  • Hi,

    I want to create a macro where user can key in the path of another excel workbook and sheet name, and copy over that entire sheet into this workbook.
    eg. A1 = file path = "C:\Temp\test.xlsx"
    B1 = sheet name = "Main"

    I have tried many method, but none is working for me..
    Can you help?


  • Try

    Dim oWb As Workbook
    Set oWb = Workbooks.Open(ActiveSheet.Range("A1").Value)
    ''/// copy required sheet to front of workbook
    oWb.Worksheets(ActiveSheet.Range("B1")).Copy Before:=ThisWorkbook.Sheets(1)
  • _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P

    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)


  • Just thought, you probably need to hide the opening & closing

  • and doevents so the workbook is open

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!