ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to copy a worksheet without its code ? (https://www.excelbanter.com/excel-programming/316928-how-copy-worksheet-without-its-code.html)

PM

How to copy a worksheet without its code ?
 
Hello !

The question says it all. I wish to copy my worksheets and remove any code
attached to them.
Is there any better way than brutally copying UsedRange and then all the
formats ?

Thanks to those would know...



Ron de Bruin

How to copy a worksheet without its code ?
 
Hi Pm

If there is no event code in the sheet module you can create a new workbook with the sheet like this

Sub test()
ActiveSheet.Copy
With ActiveWorkbook
.SaveAs "C:\ron.xls"
.Close False
End With
End Sub

Or
Sheets(Array("Sheet1", "Sheet3")).Copy
Or
Worksheets.copy

See also Chip pearson's site for code that delete code
http://www.cpearson.com/excel/vbe.htm

If you want it easy then you can use my SendMail addin and send a copy to yourself
The Add-in have a option to delete the code
http://www.rondebruin.nl/mail/add-in.htm


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


"PM" wrote in message ...
Hello !

The question says it all. I wish to copy my worksheets and remove any code attached to them.
Is there any better way than brutally copying UsedRange and then all the formats ?

Thanks to those would know...





All times are GMT +1. The time now is 09:56 AM.

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