Hello,

its says that it already exists
but its not, what do we wrong?

i copy my original sheet to a new sheet that's works and create with the name 'sheetlist (2)'
but when we wanna rename it with a new name it not allows me



Function CopyRenameSheet(NameSheet As String) As Boolean
Set _start = Nothing


CopyRenameSheet= False


On Error Resume Next
Set _start = ActiveWorkbook.WorkSheets("sheetlist (2)")
On Error GoTo 0




If _start Is Nothing Then


CopyRenameSheet= True


ActiveWorkbook.WorkSheets("sheetlist").Visible = True
ActiveWorkbook.WorkSheets("sheetlist").Copy After:=ActiveWorkbook.Sheets("HistoryItems")
          
Set OldName = _start 
On Error Resume Next


For Each mysheets In ThisWorkbook.Sheets
    If mysheets .Name = OldName  Then
        OldName.Name = NameSheet 
    End If
Next mysheets 


OldName.Name = NameSheet 


On Error GoTo 0


End If


End Function
Thanks