K
kris
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
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