Rename new worksheet

Thehunk71

New Member
Joined
Apr 1, 2006
Messages
31
I have searched the board and i can find almost what i am looking for but not quite.
I have a bit of code that creates a new worksheet.

Dim newsheet As Worksheet

Set wks = Worksheets.Add(after:=Worksheets(Worksheets.Count - 5))

With wks
End With

I need to name the new worksheet the value that is in cell a1 on a sheet called "customer data"

Thanks for you help!
 

Some videos you may like

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).

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,721
Office Version
  1. 2010
Platform
  1. Windows
Any time after your Set statement, use this line of code to name the sheet...

Code:
wks.Name = Worksheets("customer data").Range("A1").Value
 

Watch MrExcel Video

Forum statistics

Threads
1,123,487
Messages
5,601,961
Members
414,486
Latest member
Darkai

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
Top