Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Create a new worksheet and name it

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Create a new worksheet and name it

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
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
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
Create new workbook and new worksheet and close. Worksheet not saved Patrick Molloy Excel Programming 0 July 25th 09 07:00 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Excel Programming 0 July 21st 09 02:19 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Excel Worksheet Functions 0 July 20th 09 07:10 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
Can I create a worksheet menu to select each other worksheet pippagrace Excel Discussion (Misc queries) 4 June 23rd 06 01:28 PM


All times are GMT +1. The time now is 06:57 PM.

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

About Us

"It's about Microsoft Excel"