ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy a sheet (https://www.excelbanter.com/excel-discussion-misc-queries/217086-copy-sheet.html)

Dave

Copy a sheet
 
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.

Suleman Peerzade[_2_]

Copy a sheet
 
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


"Dave" wrote:

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.


Don Guillett

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

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
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.



Dave

Copy a sheet
 
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.

"Suleman Peerzade" wrote:

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


"Dave" wrote:

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.


Don Guillett

Copy a sheet
 

Did you see my response?
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
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.

"Suleman Peerzade" wrote:

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


"Dave" wrote:

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.



Dave

Copy a sheet
 
Hi Don,
Thanks for that. Works a treat.
Regards - Dave.

"Don Guillett" wrote:

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

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
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.




Don Guillett

Copy a sheet
 
Thank Chip

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
Hi Don,
Thanks for that. Works a treat.
Regards - Dave.

"Don Guillett" wrote:

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

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
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.





Dave

Copy a sheet
 
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.

Don Guillett

Copy a sheet
 
Chip is real. As for me, the jury is still out.
http://www.cpearson.com/Excel/MainPage.aspx

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dave" wrote in message
...
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.




All times are GMT +1. The time now is 07:30 AM.

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