![]() |
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. |
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. |
All times are GMT +1. The time now is 12:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com