-
Insert Template Macro
Hey all,
I'm new to programming and am trying to write a macro that will allow me to insert a template from a hidden workbook to the right of the active worksheet in the active workbook with just a keystroke. Any help would be very appreciated,
Thanks,
Brad
-
Code:
Sub AddTemplate()
Worksheets("Template").Copy After:=Worksheets(ActiveSheet.Index)
Worksheets(ActiveSheet.Index + 1).Visible = xlSheetVisible
End Sub
-
xld,
this code works if I run it in the workbook that contains the template. If I run it in another open workbook, however, it returns
subject errorr '9' subscript out of range
any ideas on how to fix this?
Thanks,
Brad
-
Then you need to qualify it with the template workbook.