Create a new worksheet and name it

B

Bishop

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.
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top