Copy Worksheet and Rename with Cell Value

Phil1981

New Member
Joined
May 27, 2011
Messages
27
I have a list of employees and I would like code to run on a button click that will copy a template sheet (Blank MAP) rename it from the emp list and continue to do this until it finds a blank cell.

My code works sometimes but when it does it is really slow. There is other code needed to grab the emp name, emp id and paste them into specific cells as well but my focus is on the worksheet creation right now.

Below is the code to create the sheets:

Sub UpdateMAPs()
Application.ScreenUpdating = False
Dim i As Integer
Dim ShName As String
i = 2
Do
Sheets("Team List").Select
ShName = Cells(i, 5).Value
Sheets("Blank MAP").Select
Sheets("Blank MAP").Copy Before:=Sheets("Blank MAP")
Sheets("Blank MAP (2)").Name = ShName
i = i + 1
Loop Until IsEmpty(Cells(i, 5).Value)
End Sub

As you can tell I am fairly new to vba so the code might be sloppy.
 
You're welcome & thanks for the feedback.
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Was it because I needed a .Value the whole time or because it was a Date vs Text? please and thank you
 
Upvote 0
The problem was that you had a date in the cell & you cannot use a / in a sheet name.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,101
Messages
6,123,096
Members
449,096
Latest member
provoking

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