View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
ckrogers ckrogers is offline
external usenet poster
 
Posts: 25
Default Add Sheet - Copy Worksheet

Got it! Thanks for your help!

"Patrick Molloy" wrote:

try:-

Option Explicit
Public Sub AddSheet()
' add a blank sheet
AddTemplateSheet ""
'copy from a template
AddTemplateSheet "Template1"
End Sub
Private Sub AddTemplateSheet(template As String)
Dim ws As Worksheet
Dim source As Range
Set ws = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
If template < "" Then
Set source = Worksheets(template).UsedRange
With ws.Range(source.Address)
.Formula = source.Formula
End With
End If
ws.Activate
End Sub


"ckrogers" wrote:

I'd like to add four buttons to a worksheet. When any of the buttons are
clicked, a sheet will be added (to the end) of a workbook. Then, depending
on which button is clicked, one of four worksheet templates will be copied
onto the new sheet. The four templates could either be four separate files,
or they could be separate sheets in one file ... whichever works
better/easier....
Help, please!
Cindy