Copying Worksheet 20 times then Rename each Worksheet

Kacer26

New Member
Joined
Dec 21, 2010
Messages
8
Hello! :confused:

I am trying to copy a worksheet about 20 times and then I need to rename each worksheet by a string name.

For Example:

ActiveSheet.Name = "VOTD Non-EXW"
ActiveSheet.Name = "VOTD Non-Pharma"
ActiveSheet.Name = "VOTD Pharma"


I found the following code that renames the worksheet by a specified date. I have been trying to adapt the code to rename my activesheet by a string but I can't seem to figure it out.

So...I managed to find this code:

Sub MakeYear()
Dim D As Date, L As Long
For L = 1 To 20
D = DateSerial(2004, 1, 1 + (L - 1) * 7)
Worksheets(1).Copy _
After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(D, "m-d-yy")
Next
End Sub

Any Assistance would be greatly appreciated
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Do you have the names of the worksheets stored somewhere?

I do have a table in another worksheet (same workbook) with the specified names of each worksheet.

Is that the only way the renaming of the worksheets can be done?

:confused:
 
Upvote 0
Well, unless you want random names then you''ll have to have as list or hardcode the list in the macro. What is the name of the sheet and what range holds the worksheet names?
 
Upvote 0
The name of the Worksheet with the Worksheet Names
is: WorkSheetReference

And the Range is A1:A20
 
Upvote 0
Try this

Code:
Sub copysheets()
Dim i As Long
For i = 1 To 20
    Sheet1.Copy after:=Worksheets.Count
    ActiveSheet.Name = Sheets("Reference").Range("A" & i).Value
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,466
Members
449,086
Latest member
kwindels

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top