ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Can I batch rename new worksheets (https://www.excelbanter.com/new-users-excel/4898-can-i-batch-rename-new-worksheets.html)

Harry Limey

Can I batch rename new worksheets
 
Is there any way to create and name new worksheets using names in an
existing database? or having created the sheets - to rename them in bulk??
TIA



Ron de Bruin

Hi Harry

Try this one with the list in Range("A2:A100") of "Sheet1"

Sub test()
Dim cell As Range
Dim WSNew As Worksheet

For Each cell In Sheets("Sheet1").Range("A2:A100").SpecialCells(xlC ellTypeConstants)
Set WSNew = Worksheets.Add
On Error Resume Next
WSNew.Name = cell.Value
If Err.Number 0 Then
MsgBox "Change the name of : " & WSNew.Name & " manually"
Err.Clear
End If
On Error GoTo 0

Next cell
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Harry Limey" <harrylimey(at)Lycos.co.uk wrote in message ...
Is there any way to create and name new worksheets using names in an
existing database? or having created the sheets - to rename them in bulk??
TIA





Harry Limey

Ron

Works perfectly - did you just write that or have it on file??
either way, I will be using that again.
Many thanks

Harry

"Ron de Bruin" wrote in message
...
Hi Harry

Try this one with the list in Range("A2:A100") of "Sheet1"

Sub test()
Dim cell As Range
Dim WSNew As Worksheet

For Each cell In

Sheets("Sheet1").Range("A2:A100").SpecialCells(xlC ellTypeConstants)
Set WSNew = Worksheets.Add
On Error Resume Next
WSNew.Name = cell.Value
If Err.Number 0 Then
MsgBox "Change the name of : " & WSNew.Name & " manually"
Err.Clear
End If
On Error GoTo 0

Next cell
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl




Ron de Bruin

Just write it, only the error check I use more
Glad you can use it

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Harry Limey" <harrylimey(at)Lycos.co.uk wrote in message ...
Ron

Works perfectly - did you just write that or have it on file??
either way, I will be using that again.
Many thanks

Harry

"Ron de Bruin" wrote in message
...
Hi Harry

Try this one with the list in Range("A2:A100") of "Sheet1"

Sub test()
Dim cell As Range
Dim WSNew As Worksheet

For Each cell In

Sheets("Sheet1").Range("A2:A100").SpecialCells(xlC ellTypeConstants)
Set WSNew = Worksheets.Add
On Error Resume Next
WSNew.Name = cell.Value
If Err.Number 0 Then
MsgBox "Change the name of : " & WSNew.Name & " manually"
Err.Clear
End If
On Error GoTo 0

Next cell
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl







All times are GMT +1. The time now is 05:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com