Copy a worksheet

  • Thread starter Thread starter Nev
  • Start date Start date
N

Nev

H Guys

can you help. i want to copy a sheet from a closed book into an open book
via vba macro.
Example is - run code to open the workbook, copy the only worksheet in that
book and paste it into an existing sheet in a workbook that is already open.

Can u help

Thanks

Nev
 
You left a lot of unanswered questions so I took some liberties. You will
have to change the name "Somefile" to the actual workbook name that you want
to copy from.

Sub cpySht()
Dim wb1 As Workbook, wb2 As Workbook
Set wb1 = ActiveWorkbook
myPath = wb1.Path
fName= myPath & "Somefile.xls" <<<Sustitute actual wb name
Worbooks.Open fName
Set wb2 = ActiveWorkbook
wb2.Sheets(1).Cells.Copy wb1.Sheets(Sheets.Count).Range("A1")
Application.CutCopyMode = False
End Sub
 
Back
Top