Private Sub Worksheet_Change(ByVal Target As Range)
Application.DisplayAlerts = False
Dim wsNew As Worksheet, s As Worksheet
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("A2:A600")) Is Nothing Then
'Set wsNew = Sheets(Target.Offset(0, 1).Text & "_" & Target.Offset(0, 2).Text)
If wsNew Is Nothing Then
Worksheets("Temp").Copy After:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).Name = Target.Offset(0, 1).Text & "_" & Target.Offset(0, 2).Text
Err.Clear
'ErrorHandler:
If Err = 1004 Then
For Each s In ActiveWorkbook.Sheets
If Right(s.Name, 5) = "(*" Then
s.Delete
End If
Next s
End If
Exit Sub
End If
End If
End Sub
I want to be able have it only warn me there is already a sheet with that name but not copy the original with the (#). I have about 24 of these now. Temp (#).
Bookmarks