To create new sheet every time new information is added

Closed
tuang
Posts
1
Registration date
Thursday January 22, 2015
Status
Member
Last seen
January 22, 2015
- Jan 22, 2015 at 10:09 AM
I am currently creating a wage calculation template in excel. There are 3 sheets currently in my file. First is "employee information". Second is "employee total payroll". And third is "time card".

1. On "employee information" sheet, there will be table that contain ID column, employee name column, etc. Can you help me creating a code that will add new sheet every time a new employee name is added?

2. Can you make it rename this new sheet according to ID column?

3. Can you make my "time card" sheet to be a template for every new sheet created from step 1?

Very appreciate for your help and prompt reply.



For your information, I did try to solve my first problem with this code:

Sub CreateSheetsFromAList()
Dim MyCell As Range, MyRange As Range

Set MyRange = Sheets("Summary").Range("A10")
Set MyRange = Range(MyRange, MyRange.End(xlDown))

For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
Next MyCell
End Sub

However, it doesn't create new sheet every time I add new employee name. I need to press run on macro to use the function. The problem is that it also creates new sheet for existed employee which I don't need.