Try this one
Sub craetenames()
Dim i As Long, LR As Long, NR As Long, nome As String, sh As Worksheet, ws As Worksheet
Application.ScreenUpdating = False
On Error Resume Next
For Each ws In ThisWorkbook.Worksheets
With ws
If .Name <> "Call_centr" Then
.Cells.ClearContents
End If
End With
Next ws
With Sheets("Call_centr")
LR = .Cells.Find("*", , , , xlByRows, xlPrevious).Row
For i = 2 To LR
If Trim(.Range("B" & i).Value) <> "" Then
nome = Trim(.Range("B" & i).Value)
If Not Evaluate("ISREF('" & nome & "'!A1)") Then
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = nome
End If
.Range("A1:AD1").Copy Worksheets(nome).Range("A1")
.Rows(i).Copy
Worksheets(nome).Range("A" & Rows.Count).End(xlUp)(2).PasteSpecial (xlPasteValuesAndNumberFormats)
End If
Next i
Application.CutCopyMode = 0
End With
For Each sh In ThisWorkbook.Worksheets
Application.DisplayAlerts = 0
If InStr((sh.Name), "Sheet") > 0 Then sh.Delete
sh.Columns("A:AD").EntireColumn.AutoFit
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = 1
End Sub
Bookmarks