naming newly created worksheets

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

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

Naming of newly created worksheets

resolvedResolved · Low Priority · Version 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:

Create a unique items table from a duplicating table

1. Ensure that your list has column headings
2. Select the entire list
3. From the menu bar, select DATA, FILTER, ADVANCED FILTER
4. Select "Filter the list, in place", and tick the "Unique Records Only" box
5. Click OK, filtered list appears.

View all Excel hints and tips


Server loaded in 0.07 secs.