Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy a worksheet
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy a worksheet
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 "Nev" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy method of worksheet class failed: trying to copy a hidden she | Excel Programming | |||
copy method of worksheet class failed: trying to copy a hidden she | Excel Programming | |||
copy method of worksheet class failed: trying to copy a hidden she | Excel Programming | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming | |||
Code to copy range vs Copy Entire Worksheet - can't figure it out | Excel Programming |