View Single Post
 
Old 04-30-2009, 11:54 AM
TeePee TeePee is offline
Novice
 
Join Date: Apr 2009
Posts: 1
TeePee is on a distinguished road
Default Create Multiple Tabs from Template

Hi Everyone

I am looking to create a macro that would allow me to create multiple worksheets (in the same workbook) from a single already created template. Ideally the tabs would also rename themselves based on a pre-existing list of employee numbers. And if at all possible each employee number on the list would have an hyperlink to its newly created worksheet. The VB code I currently have is as follows;

Sub Add_Sheets()
Dim rCell As Range
Dim bTemplate As Worksheet
Set bTemplate = Worksheet.Open("C:\Documents and Settings\me\Application Data\Microsoft\Templates\Attendance_Calendar.xlt", 0, True)
For Each rCell In ThisWorkbook.Sheets("Sheet2").Range("A2:A518")
bTemplate.Sheet(21).Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Cou nt)
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Nam e = rCell.Value
Next rCell
bTemplate: Close
End Sub

However I keep receiving several errors....can anyone help with this code, or suggest something similiar (even without hyperlinks) that would save me from having to manulally copy the template for each employee
Reply With Quote