ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coping a sheet (https://www.excelbanter.com/excel-programming/294484-coping-sheet.html)

james

Coping a sheet
 
Hello

Can you tell me what the VBA code is for copying a sheet out of one book into a new one

Thanks in advance
James

Frank Kabel

Coping a sheet
 
Hi
have a look at
http://www.rondebruin.nl/copy4.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"James" schrieb im Newsbeitrag
...
Hello,

Can you tell me what the VBA code is for copying a sheet out of one

book into a new one?

Thanks in advance,
James



Ron de Bruin

Coping a sheet
 
Hi James

You can use
Activesheet.Copy or Sheets("Sheet3").Copy

To create a new workbook with only that sheet


Or this

This example will copy the first sheet of the activeworkbook.
It open the file C:\test.xls and paste the sheet.
After that it will save/close the file C:\test.xls

Sub test()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
Application.ScreenUpdating = False
Set Wb1 = ActiveWorkbook
Set Wb2 = Workbooks.Open("C:\test.xls")
Wb1.Worksheets(1).Copy after:= _
Wb2.Sheets(Wb2.Sheets.Count)
Wb2.Close True
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"James" wrote in message ...
Hello,

Can you tell me what the VBA code is for copying a sheet out of one book into a new one?

Thanks in advance,
James





All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com