Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

naming newly created worksheets

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Naming of newly created worksheets

Naming of newly created worksheets

ResolvedVersion 2003

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

Mon 30 May 2011: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Charts

Select the data and press the function key F11 and the chart will be created on a separate worksheet.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.