PDA

View Full Version : Solved: Duplicating a worksheet



JKwan
09-15-2010, 02:02 PM
I was wondering how can I duplicate a worksheet to another with exact contents, layout, combo boxes on the sheet and code to that worksheet? I tried using copy / paste but my layout is not brought across - even using paste special, format.

Simon Lloyd
09-15-2010, 02:58 PM
Errrm why not just copy the worksheet?, right click on the sheet tab>move or copy>click the checkbox for copy>ok

someboddy
09-15-2010, 04:18 PM
Use the worksheet.copy function. You can use the before or after argument(Not both. It'll produce an error) to copy it to an existing workbook like this:
mySheet.Copy after:=Worksheets(Worksheets.Count) 'copies as the last sheet in the workbook
or call it with no arguments to create a new workbook.

The function returns the new worksheet object.

JKwan
09-15-2010, 05:44 PM
Thank you both! Never realized it was so simple.