Hello! I am using the below code to insert new worksheets based on a list. The problem is, whenever I add a new client to the list, and run the code, I get error 1004 That name is already taken. I would like to get some help in order the code to skip the sheets already made and only add the new values.
Sub CreateSheetsFromList()
Dim ws As Worksheet, Ct As Long, c As Range
Set ws = Worksheets("minta")
Application.ScreenUpdating = False
For Each c In Sheets("kliensek").Range("A2:A50")
If c.Value <> "" Then
ws.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = c.Value
Ct = Ct + 1
End If
Next c
If Ct > 0 Then
MsgBox Ct & " új kliens hozzáadva"
Else
MsgBox "Klienslista üres!"
End If
Application.ScreenUpdating = True
End Sub
Sub CreateSheetsFromList()
Dim ws As Worksheet, Ct As Long, c As Range
Set ws = Worksheets("minta")
Application.ScreenUpdating = False
For Each c In Sheets("kliensek").Range("A2:A50")
If c.Value <> "" Then
ws.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = c.Value
Ct = Ct + 1
End If
Next c
If Ct > 0 Then
MsgBox Ct & " új kliens hozzáadva"
Else
MsgBox "Klienslista üres!"
End If
Application.ScreenUpdating = True
End Sub