I am trying to copy the first sheet once/click and name it automatically as current date.
first click is adding 2 sheets (10-Jun-21 & 10-Jun-21 (2));
Second click is adding Operator(2) & 10-Jun-21 (3);
third click is adding Operator(3) & 10-Jun-21(4);
When i click the button 4th time is adding one sheet per click (10-Jun-21(5)).
I don't understand why after the 4th click does what i want it to do. Here is my code. Thank you!!!
Private Sub CommandButton1_Click()
Dim I As Long
Dim szTodayDate As String
szTodayDate = Format(Date, "mmm-dd-yyyy")
On Error Resume Next
Sheets("Operator").Copy After:=Worksheets(Worksheets.Count)
Do
ActiveSheet.Name = szTodayDate
Sheets(szTodayDate).Copy After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = szTodayDate
Loop While ActiveSheet.Name = szTodayDate
End Sub
Bookmarks