How to copy a worksheet without its code ?

  • Thread starter Thread starter PM
  • Start date Start date
P

PM

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...
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top