![]() |
Copying large number of sheets
Hi,
I have a spreadsheet which contains a summary page and a number of branch sheets (each should be on a separate tab). How do I replicate the branch sheets automatically (there are 50 of them needed) without having to copy it 50 times? Is there a way I can name each of the tabs automatically too, i.e with their branch name? (Andover; Southampton etc etc) Thanks Amanda |
Copying large number of sheets
i would have a templet and then copy it like below. you need to havve a list
of branch names. You may want to do this as part of importing the data from some external source. Sub CopyBranch() Set BranchRange = Sheets("sheet1").Range("A1:A20") For Each cell In BranchRange Worksheets("templet").Select Worksheets("templet").Copy After:=Sheets("templet") ActiveSheet.Name = cell Next cell End Sub "Amanda" wrote: Hi, I have a spreadsheet which contains a summary page and a number of branch sheets (each should be on a separate tab). How do I replicate the branch sheets automatically (there are 50 of them needed) without having to copy it 50 times? Is there a way I can name each of the tabs automatically too, i.e with their branch name? (Andover; Southampton etc etc) Thanks Amanda |
Copying large number of sheets
Thanks for this joel,
Where do I type this information in to to get it to run the query, is it a macro? Thanks Amanda "Joel" wrote: i would have a templet and then copy it like below. you need to havve a list of branch names. You may want to do this as part of importing the data from some external source. Sub CopyBranch() Set BranchRange = Sheets("sheet1").Range("A1:A20") For Each cell In BranchRange Worksheets("templet").Select Worksheets("templet").Copy After:=Sheets("templet") ActiveSheet.Name = cell Next cell End Sub "Amanda" wrote: Hi, I have a spreadsheet which contains a summary page and a number of branch sheets (each should be on a separate tab). How do I replicate the branch sheets automatically (there are 50 of them needed) without having to copy it 50 times? Is there a way I can name each of the tabs automatically too, i.e with their branch name? (Andover; Southampton etc etc) Thanks Amanda |
Copying large number of sheets
I didn't know whre the dta was coming from. I will help you if you like.
Record a macro while doing one query, then we can modify the recorded macro to do all the queries. You will need to have a column on one worksheets witth all the branch names. you start recording tthe macro by going to Tools Menu - Macro - Record new Macro. Then do one query for a branch. Affter doing the query then go back to Tools Menu - Macro -Stop Recording. Next post macro on website. To get macro right click on tab at bottom of worksheet and selct veiw code. then on left side of screen in Project manager select Module 1. "Amanda" wrote: Thanks for this joel, Where do I type this information in to to get it to run the query, is it a macro? Thanks Amanda "Joel" wrote: i would have a templet and then copy it like below. you need to havve a list of branch names. You may want to do this as part of importing the data from some external source. Sub CopyBranch() Set BranchRange = Sheets("sheet1").Range("A1:A20") For Each cell In BranchRange Worksheets("templet").Select Worksheets("templet").Copy After:=Sheets("templet") ActiveSheet.Name = cell Next cell End Sub "Amanda" wrote: Hi, I have a spreadsheet which contains a summary page and a number of branch sheets (each should be on a separate tab). How do I replicate the branch sheets automatically (there are 50 of them needed) without having to copy it 50 times? Is there a way I can name each of the tabs automatically too, i.e with their branch name? (Andover; Southampton etc etc) Thanks Amanda |
Copying large number of sheets
did you get your query to work with a macro?
"Amanda" wrote: Thanks for this joel, Where do I type this information in to to get it to run the query, is it a macro? Thanks Amanda "Joel" wrote: i would have a templet and then copy it like below. you need to havve a list of branch names. You may want to do this as part of importing the data from some external source. Sub CopyBranch() Set BranchRange = Sheets("sheet1").Range("A1:A20") For Each cell In BranchRange Worksheets("templet").Select Worksheets("templet").Copy After:=Sheets("templet") ActiveSheet.Name = cell Next cell End Sub "Amanda" wrote: Hi, I have a spreadsheet which contains a summary page and a number of branch sheets (each should be on a separate tab). How do I replicate the branch sheets automatically (there are 50 of them needed) without having to copy it 50 times? Is there a way I can name each of the tabs automatically too, i.e with their branch name? (Andover; Southampton etc etc) Thanks Amanda |
All times are GMT +1. The time now is 08:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com