MrExcel Publishing
Your One Stop for Excel Tips & Solutions

programatically copying worksheet from one workbook to another

Posted by al furman on July 31, 2001 10:20 AM

How can I programatically copy a worksheet from one workbook to another? I know I could manually copy cell values but it seems there must be an easier way to simply insert the entire contents of a worksheet into a different workbook. Thanks in Advance! - Al

Posted by Mark W. on July 31, 2001 10:43 AM

What's easier than right mouse clicking on the tab
of the worksheet that you want to copy, checking
"Create a copy" and then choosing the destination
workbook using the "To book" drop-down list.

Posted by al furman on August 01, 2001 6:40 AM

Mark W.,

I appreciate your candid help, but apparently you missed the meaning of the word "programmatically". I know its possible within the excel environment itself, but this functionality has not been obviously exposed in the excel object model. So, if you have any insight on how its done in code, I'd love to see it. (how easy is that)

Posted by Mark W. on August 01, 2001 8:28 AM

No, I didn't miss the meaning of "programmatically".
I just thought that functionality provided by the
GUI was so elegant that it didn't warrant the
creation of custom code.

Posted by John on August 01, 2001 11:47 AM

Try this. It's "programatic" and you can even create a button and assign this macro to it.

Sub CopyNew()
' CopyNew Macro

End Sub