Bonjour à tous,
Sujet maintes fois abordé 8)
Vois ceci :
Option Explicit
Sub creation_feuilles()
Dim rng As Range, i As Long, e
Set rng = Sheets("original").Range("a1").CurrentRegion
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To rng.Rows.Count
If Not .exists(rng.Cells(i, 1).Value) Then
Set .Item(rng.Cells(i, 1).Value) = _
Union(rng.Rows(1), rng.Rows(i))
Else
Set .Item(rng.Cells(i, 1).Value) = _
Union(.Item(rng.Cells(i, 1).Value), rng.Rows(i))
End If
Next
For Each e In .keys
If Not IsSheetExists(e) Then
Sheets.Add(after:=Sheets(Sheets.Count)).Name = e
End If
Sheets(e).Cells(1).CurrentRegion.Clear
.Item(e).Copy Sheets(e).Cells(1)
Next
End With
Application.CutCopyMode = False
End Sub
Function IsSheetExists(ByVal sn As String) As Boolean
On Error Resume Next
IsSheetExists = Len(Sheets(sn).Name)
On Error GoTo 0
End Function
klin89