I am trying to create a copy of a worksheet called TEMPLET & name the new worksheet a month end date like 63005.

I am having trouble getting the code to loop until a unique name (month end date) is entered in the input box.

The code loops correctly as long as there is a duplication, but stops when a unique name (month end date) is entered.

My current code is below, but I have tried loop variations with no success. Any ideas?

Thanks a million,

mikeburg

Sub createworksheet()
Dim monthenddate As String
Dim monthendname As String
monthenddate = Application.InputBox("Enter month end date ex-08-31-05: ")
monthendname = Replace(monthenddate, "-", "")
If monthenddate = "" Then GoTo done
duped:
If monthendname = Sheets(monthendname).Name Then
monthenddate = Application.InputBox("A worksheet aready exists for " & monthendname & ", enter a different date or cancel ex-08-31-05: ")
monthendname = Replace(monthenddate, "-", "")
If monthenddate = "" Then GoTo done
End If
If monthendname = Sheets(monthendname).Name Then GoTo duped
Sheets("Templet").Copy Before:=Sheets(1)
Sheets("Templet (2)").Name = monthendname
Sheets(monthendname).Range("H1") = monthenddate
done:
End Sub