Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nev Nev is offline
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy method of worksheet class failed: trying to copy a hidden she sam Excel Programming 4 August 8th 09 11:19 PM
copy method of worksheet class failed: trying to copy a hidden she sam Excel Programming 0 August 7th 09 11:16 PM
copy method of worksheet class failed: trying to copy a hidden she sam Excel Programming 0 August 7th 09 11:16 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"