MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Copy sheet from another workbook through VBA


Posted by Barrie O on June 29, 2001 3:06 PM

I would like to do something similar to another post I've seen. Put a button in a workbook with code that will open another file and import a specific sheet from that workbook. Suggestions??


Posted by Scott on June 29, 2001 3:49 PM

Try this:

Sub Open_and_paste()

Workbooks.Open FileName:="workbook to open.xls"
Cells.Select
Selection.Copy
Windows("Book1").Activate
Sheets("Sheet2").Select
ActiveSheet.Paste
End Sub

You will have to change "Book1" to the name of the workbook with the button. It is assuming that "Sheet2" is where you want to paste to.