PC Review


Reply
Thread Tools Rate Thread

Create a new worksheet and name it

 
 
Bishop
Guest
Posts: n/a
 
      5th Mar 2010
I have a range of cells (say A7:A20). Each cell has a persons name. I need
to write code that will go through each cell, copy the name, create a new
worksheet (in the same workbook), and name the worksheet using the copied
name. So in this case, for example, after the code executes I would have my
original worksheet with the names in cells A7:A20 and I would have 14 more
sheets, each with one of the names from the range of cells.
 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      5th Mar 2010
Sub Add_Sheets()
Dim rCell As Range
For Each rCell In Range("A7:A20")
With Worksheets.Add(After:=Worksheets(Worksheets.Count))
.Name = rCell.Value
End With
Next rCell
End Sub


Gord Dibben MS Excel MVP

On Fri, 5 Mar 2010 12:29:10 -0800, Bishop <(E-Mail Removed)>
wrote:

>I have a range of cells (say A7:A20). Each cell has a persons name. I need
>to write code that will go through each cell, copy the name, create a new
>worksheet (in the same workbook), and name the worksheet using the copied
>name. So in this case, for example, after the code executes I would have my
>original worksheet with the names in cells A7:A20 and I would have 14 more
>sheets, each with one of the names from the range of cells.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create new workbook and new worksheet and close. Worksheet not saved Patrick Microsoft Excel Programming 1 25th Jul 2009 07:00 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Microsoft Excel Programming 0 21st Jul 2009 02:19 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Microsoft Excel Worksheet Functions 0 20th Jul 2009 07:10 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error acctemp@millenniumbank.com Microsoft Excel Misc 4 25th Sep 2006 01:35 PM
Can I create a worksheet menu to select each other worksheet =?Utf-8?B?cGlwcGFncmFjZQ==?= Microsoft Excel Misc 4 23rd Jun 2006 01:28 PM


Features
 

Advertising
 

Newsgroups
 


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