Paul's solution perfectly ok - but if you are only adding 1 button to master
sheet you only need simple change to code:
Sub CopySheet()
Dim ShName As Variant
TOP:
ShName = Application.InputBox(prompt:="Enter New Name", Title:="Rename
Worksheet", Type:=2)
If VarType(ShName) = vbBoolean Then
If ShName = False Then
Debug.Print "cancelled"
Exit Sub
End If
End If
On Error Resume Next
If Worksheets(ShName) Is Nothing Then
With ActiveSheet
.Copy after:=Sheets(.Index)
End With
With ActiveSheet
.Name = StrConv(ShName, vbProperCase)
.Buttons(1).Delete
End With
Else
MsgBox ShName & " Sheet Already Exists"
GoTo TOP
End If
End Sub
Hope helpful
--
JB
"Vimal Lalla" wrote:
> i have placed a button on the master page, when i click the button, it
> creates the new sheet as i want it to, but it also copies the button, is
> there a way to exclude that.
>
> "Vimal Lalla" wrote:
>
> > Hi
> >
> > I am new to excel, I have created a master worksheet, i want to copy that
> > entire worksheet with its formatting to a new worksheet with a different
> > name, can anyone help me out
|