ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy worksheet without code behind (https://www.excelbanter.com/excel-programming/388784-copy-worksheet-without-code-behind.html)

clara

Copy worksheet without code behind
 
Hi all,

I have to copy a worksheet from one workbook into another workbook, but the
code behind the worksheet must left alone. Could you tell me how?

Clara
--
thank you so much for your help

LT

Copy worksheet without code behind
 
On May 4, 3:37 pm, clara wrote:
Hi all,

I have to copy a worksheet from one workbook into another workbook, but the
code behind the worksheet must left alone. Could you tell me how?

Clara
--
thank you so much for your help


I'm not knowing how to do that with code, but I do know how to do that
manually if it will help.

hit alt+F11 to bring up the VBA editor. Look on the left hand side
you will see a list of open workbooks and the worksheets belonging to
them.

From the COPIED worksheet, double click the sheet name of the copy, a

code window will appear with all the code tha is attached to the
sheet. Select it all and then delete and then go back to the Excel
workbook that is your copy and save that.

Hope that Helps!

-LT


Tom Ogilvy

Copy worksheet without code behind
 
Dim srcbook as Workbook, destBook as Workbook
Dim sh as Worksheet
set srcBook = Activeworkbook
set sh = srcBook.Worksheets("SheetName")
set destBook = workbooks("Dest.xls")
With destbook
.Worksheets.Add after:=.worksheets(.worksheets.count)
sh.cells.copy .Worksheets(.worksheets.count).Cells
End With

--
Regards,
Tom Ogilvy




"clara" wrote:

Hi all,

I have to copy a worksheet from one workbook into another workbook, but the
code behind the worksheet must left alone. Could you tell me how?

Clara
--
thank you so much for your help



All times are GMT +1. The time now is 06:58 PM.

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