Hi everyone,
I'm new to the forum, and I have searched far and wide to find a macro to accomplish the below. Here is my current worksheet.
- Single sheet named "Staff" for which cells A2:A34 contain staff names and cells B2:B34 contain staff "titles" (4 different titles "Operations", "Register", "Manager" & "Sales".
- 4 Separate worksheet templates for each title named "Cook Master", "Register Master", "Manager Master" & "Sales Master"
I"m trying to create a macro that will:
1. Create a copy of the corresponding master sheet for each staff member in column A based on their title in column B;
2. Rename cell A1 in each sheet with the staff members name from the list;
3. Loop that if the macro button is pressed a subsequent time, for any new/changed names on the list new worksheets are created, and duplicates are ignored.
I am using the following code to create and rename, however it is based on one master sheet.
Any help would be much appreciated.
EDIT: I'm using Windows Excel 2010 and Mac Excel 2011
I'm new to the forum, and I have searched far and wide to find a macro to accomplish the below. Here is my current worksheet.
- Single sheet named "Staff" for which cells A2:A34 contain staff names and cells B2:B34 contain staff "titles" (4 different titles "Operations", "Register", "Manager" & "Sales".
- 4 Separate worksheet templates for each title named "Cook Master", "Register Master", "Manager Master" & "Sales Master"
I"m trying to create a macro that will:
1. Create a copy of the corresponding master sheet for each staff member in column A based on their title in column B;
2. Rename cell A1 in each sheet with the staff members name from the list;
3. Loop that if the macro button is pressed a subsequent time, for any new/changed names on the list new worksheets are created, and duplicates are ignored.
I am using the following code to create and rename, however it is based on one master sheet.
Code:
Sub CreateStaff()
Sheets("Staff").Activate
For Each cell In Sheets("Staff").Range("A2", Range("A34").End(xlUp))
If Not SheetExists(cell.Value) Then
Sheets("Master").Copy After:=Sheets(Sheets.Count)
With ActiveSheet
.Name = cell
.Range("A1") = cell
End With
End If
Sheets("Staff").Activate
Next
End Sub
EDIT: I'm using Windows Excel 2010 and Mac Excel 2011
Last edited: