View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MCSmarties MCSmarties is offline
external usenet poster
 
Posts: 6
Default Macro REQ: Automatically copy a template sheet and rename

Awesome macro Trevor, many thanks!

On Oct 10, 4:34 pm, "Trevor Shuttleworth"
wrote:
OK, maybe this will do what you need:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim DestWs As Worksheet
If Me.Name < "Template" Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Intersect(Target, Range("F3")) Is Nothing Then Exit Sub

Sheets("template").Copy after:=Sheets(Sheets.Count)
Set DestWs = ActiveSheet
On Error Resume Next
DestWs.Name = Range("F3").Value
On Error GoTo 0

Application.EnableEvents = False
Target.Value = "" ' clear template
Application.EnableEvents = True
End Sub

Regards

Trevor

<snip