I tried putting this into my command button as follows:
but it does not work, i'm not quite sure what i'm doing wrong here?
Thanks!
Code
-------------------
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Set ws = Worksheets("Tamplet")
ws.Copy Worksheets(1)
SetSheetName Worksheets(1)
End Sub
Private Sub SetSheetName(ws As Worksheet)
On Error Resume Next
Dim sname As String
Dim index As Long
index = 0
Do
Err.Clear
index = index + 1
sname = "Tamplet" & Format$(index, "000")
ws.Name = sname
Loop While Err.Number <> 0
End Su
-------------------
--
foxgguy200
-----------------------------------------------------------------------
foxgguy2005's Profile:
http://www.excelforum.com/member.php...fo&userid=2366
View this thread:
http://www.excelforum.com/showthread.php?threadid=37888