LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default How to Copy entire Worksheet from Workbook S to Workbook D

I want to copy a worksheet from workbook "S.xls" and pase it into Worksheet
of Workbook "D.xls" .I am trying to do something like this,also i can't pass
Workbook Byref.

Sub run_copysheet()
Dim Source, Dest As Workbook

Set Source = Application.Workbooks.Open("c:\S.xls")
Set Dest = Application.Workbooks.Open("c:\D.xls")

Call copysheet(Source, "Sheet1", Source, "Sheet1")

End Sub


Function copysheet(ByVal S1 As Workbook, ByVal SSheetName As String, ByVal
D1 As Workbook, ByVal DSheetName As String)

S1.Worksheets(SSheetName).Activate
Rows("1:30").Select
Selection.Copy

Set D1 = ActiveWorkbook
D1.Worksheets(DSheetName).Activate
Cells.Select
ActiveSheet.Paste


End Function

 
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 entire contents worksheet into new workbook, link but editabl ellyk Excel Discussion (Misc queries) 0 May 12th 10 08:49 PM
how do i copy an entire workbook and paste it in another BELINDA New Users to Excel 1 June 11th 07 01:02 PM
copy entire row to another workbook Craig[_24_] Excel Programming 5 April 21st 06 10:05 PM
Copy Data from Workbook into specific Worksheet in other Workbook? kingdt Excel Discussion (Misc queries) 1 March 16th 06 06:55 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


All times are GMT +1. The time now is 06:09 PM.

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

About Us

"It's about Microsoft Excel"