|
-
Apr 23rd, 2020, 01:26 PM
#1
Thread Starter
Fanatic Member
Copy Worksheet
I have an Excel workbook with one sheet named "Template"
I obviously want to use that template sheet to create new sheets.
How do I copy that sheet to a new sheet?
I've scoured google and it's killing me that I can't find an applicable answer.
This question must have been asked and answered many times.
Dim xlapp As Excel.Application, xlworkbook As Excel.Workbook, xlworksheet As Excel.Worksheet
-
Apr 23rd, 2020, 01:40 PM
#2
Re: Copy Worksheet
Hello,
Have a look here and here
regards
The best friend of any programmer is a search engine 
"Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
“They did not know it was impossible so they did it” (Mark Twain)
-
Apr 24th, 2020, 11:08 AM
#3
Thread Starter
Fanatic Member
Re: Copy Worksheet
Thanks Delany.
Ended up using
Code:
xlworksheet = xlworkbook.Sheets("Sheet1") 'Set sheet to be copied
xlworksheet.Copy(Type.Missing, xlworkbook.Sheets(xlworkbook.Sheets.Count)) 'Copy as new sheet at end
xlworksheet = xlworkbook.Sheets(xlworkbook.Sheets.Count) 'Set new sheet as one to work with
-
Apr 24th, 2020, 11:09 AM
#4
Thread Starter
Fanatic Member
Re: Copy Worksheet
Thanks Delany.
Ended up using
Code:
xlworksheet = xlworkbook.Sheets("Sheet1") 'Set sheet to be copied
xlworksheet.Copy(Type.Missing, xlworkbook.Sheets(xlworkbook.Sheets.Count)) 'Copy as new sheet at end
xlworksheet = xlworkbook.Sheets(xlworkbook.Sheets.Count) 'Set new sheet as one to work with
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|