naming newly created worksheets
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

replyReply Fri 20 May 2011, 16:51Delegate Emma said...

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

For upcoming training course dates see: Pricing & availability

replyReply Mon 23 May 2011, 13:21Trainer Anthony said...

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.

 

Please browse our web site to find out more about
excel training class and other Microsoft training courses.

Excel tip:

Purchase excel

Buy MS Excel on Amazon.com

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard