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

    1. Dim oWb As Workbook
    2. Set oWb = Workbooks.Open(ActiveSheet.Range("A1").Value)
    3. ''/// copy required sheet to front of workbook
    4. oWb.Worksheets(ActiveSheet.Range("B1")).Copy Before:=ThisWorkbook.Sheets(1)
  • Check out our new reputation system. Click on the Like button under the post!

    [SIZE=8px]There are 10 types of people in the world. Those that understand Binary and those that dont.

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

    The BEST Lookup function of all time

    Dynamic Named Ranges are your bestest friend[/SIZE]

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

  • and doevents so the workbook is open