Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Harry Limey
 
Posts: n/a
Default 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


  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

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




  #3   Report Post  
Harry Limey
 
Posts: n/a
Default

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



  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
duplicating worksheets Ralph2 Excel Discussion (Misc queries) 1 January 20th 05 06:05 AM
Number of worksheets Mark Excel Discussion (Misc queries) 1 January 18th 05 11:05 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 11:05 PM
data entry on multiple worksheets diosdias Excel Discussion (Misc queries) 1 December 7th 04 06:33 PM
Assigning Cells in worksheets to other data in other worksheets. David McRitchie Excel Discussion (Misc queries) 0 November 27th 04 07:15 PM


All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"