Copy a sheet

D

Dave

Hi
XL2003
When copying a sheet into another worbook using VBA, is it possible to do so
without also copying any code in that sheet's code window?
ie, I have a sheet with some event code, which I want copied into another
workbook, without it's event code.
Regards - Dave.
 
S

Suleman Peerzade

Please try this
For eg. The workbook from where you require to copy a sheet is open and also
the workbook where in you need to paste that sheet is open. Then right click
on the sheet tab (of the sheet to be copied) tick (Create a copy check box)
then in the drop down (to Book) you can either place this sheet in a new book
or the one which is open.
No codes required.
--
_______________________
Click "Yes" button if it helps
________
Thanks
Suleman Peerzade
 
D

Don Guillett

From Chip Pearson, code to clear sheet module. Then copy sheet to new wb.

With ThisWorkbook
With .VBProject.VBComponents(.Worksheets("sheet17").CodeName).CodeModule
.DeleteLines 1, .CountOfLines
End With
End With
 
D

Dave

Hi Suleman,
What you describe is what I do at present, but the code attached to the
sheet goes with it, which I am trying to prevent.
Regards - Dave.
 
D

Dave

Yeah, but you were the link, so thanks for that. And besides, I'm not sure if
Chip is a real person (or you, for that matter). I don't think real people
know all that stuff...
Dave.
 

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

Top