Hi all.
I have been tasked with updating the excel files used in my job, a lot of the staff are very very basic with anything computer related so I am trying to make the files more user friendly.
I work in a charity that depends on funding so asyou can imagin its hard to get skilled staff. I have an ok understanding of excel and how macros work but I am very new to VBA and was wonder would anyone help me figure my way through a couple of issues.
I have 2 wrok sheets one called Main and one called Template.
I need to create a VBA button on Main that will duplicate Template and name it from the value in cell A1 on the Main worksheet.
Heres the code I have so far.
Sub testcopy()
Dim wks As Worksheet
Set wks = ActiveSheet
ActiveSheet.Copy after:=Worksheets(Sheets.Count)
ActiveSheet.Name = wks.Range("A1").Value
wks.Activate
End Sub
When I run it, it dups the page that is active and names it with the value in cell A1 of the active sheet.
How do I make it copy the Template sheet and rename from A1 on the Main sheet?
Thenks very much for the help.
I have been tasked with updating the excel files used in my job, a lot of the staff are very very basic with anything computer related so I am trying to make the files more user friendly.
I work in a charity that depends on funding so asyou can imagin its hard to get skilled staff. I have an ok understanding of excel and how macros work but I am very new to VBA and was wonder would anyone help me figure my way through a couple of issues.
I have 2 wrok sheets one called Main and one called Template.
I need to create a VBA button on Main that will duplicate Template and name it from the value in cell A1 on the Main worksheet.
Heres the code I have so far.
Sub testcopy()
Dim wks As Worksheet
Set wks = ActiveSheet
ActiveSheet.Copy after:=Worksheets(Sheets.Count)
ActiveSheet.Name = wks.Range("A1").Value
wks.Activate
End Sub
When I run it, it dups the page that is active and names it with the value in cell A1 of the active sheet.
How do I make it copy the Template sheet and rename from A1 on the Main sheet?
Thenks very much for the help.