Emma has attended:
Excel VBA Intro Intermediate course
Naming of newly created worksheets
Hi,
I have a template worksheet.
I also have a list of people.
I'm trying to create a copy of the template worksheet for each person in the list.
So far, I've written code which works (see below) - except I want each worksheet to be named as the persons name (taken from the list) & all I'm getting is the row number.
I've attempted various things - but nothing successfully!
Thanks,
Emma
Option Explicit
Option Compare Text
Dim intRow As Integer
Sub CopyTemplate()
Dim intRowCount As Integer
For intRowCount = 2 To Sheets("List Page").Range("A1").CurrentRegion.Rows.Count
Sheets("Data").Select
Sheets("Data").Copy after:=Sheets(8)
ActiveSheet.Name = intRowCount
Next intRowCount
End Sub
RE: Naming of newly created worksheets
Hi Emma, thanks for your query. Try changing:
ActiveSheet.Name = intRowCount
to..
ActiveSheet.Name = Sheets("List Page").Range("A1").cells(introwcount, 1).value
Anthony