Good Afternoon,
I'm currently having trouble with my code to name a new sheet (when created) with the value from column A, using the last row used as guidance.
The userform adds the data to the list and it should copy a worksheet named "Template" and rename itself to the last info added on column A on the "Checklist" sheet.
I've been teaking it and this i what i have so far:
The problem lies mainly in this section:
I'm adding screenshots of the sheets, the code i started with and the code i currently have for context.
All suggestions are welcome!
Thank you!
I'm currently having trouble with my code to name a new sheet (when created) with the value from column A, using the last row used as guidance.
The userform adds the data to the list and it should copy a worksheet named "Template" and rename itself to the last info added on column A on the "Checklist" sheet.
I've been teaking it and this i what i have so far:
VBA Code:
Private Sub SUBMIT1_Click()
Dim LR As Long
Dim ws As Worksheet
Set ws = Worksheets("Checklist")
'Determine LR
LR = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1
'Transfer information
Cells(LR, 1).Value = NAME1.Value
Cells(LR, 2).Value = CODE1.Value
Cells(LR, 3).Value = ID1.Value
Cells(LR, 4).Value = LEVEL1.Value
Cells(LR, 5).Value = DEPT1.Value
Cells(LR, 6).Value = DATE1.Value
NAME1.Value = ""
CODE1.Value = ""
ID1.Value = ""
LEVEL1.Value = ""
DEPT1.Value = ""
'When you submit data, it creates new employee sheet,
'using the "Template" Worksheet and naming it after them
Worksheets("Template").Copy After:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).NAME = ws.NAME(ws.Cells(Rows.Count, 1)).End(xlUp).Row + 1
Worksheets("Checklist").Activate
End Sub
The problem lies mainly in this section:
VBA Code:
'When you submit data, it creates new employee sheet,
'using the "Template" Worksheet and naming it after them
Worksheets("Template").Copy After:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).NAME = ws.NAME(ws.Cells(Rows.Count, 1)).End(xlUp).Row + 1
I'm adding screenshots of the sheets, the code i started with and the code i currently have for context.
All suggestions are welcome!
Thank you!