spitfire378
XLDnaute Occasionnel
Bonjour a tous, j'ai dans une colonne des villes, des départements ou des régions et j'aimerai regrouper ces différents éléments dans des groupes. J'ai essayé le code suivant mais sans succès :
Si vous pouviez m'aider merci d'avance
Code:
Dim y As Range
Dim p1 As Long
Dim p2 As Long
Dim p3 As Long
Dim p4 As Long
Dim p5 As Long
Dim p6 As Long
Dim p7 As Long
Dim p8 As Long
p1 = 0
p2 = 0
p3 = 0
p4 = 0
p5 = 0
p6 = 0
p7 = 0
On Error Resume Next
For Each y In Range("AB2:AB" & [AB65000].End(xlUp).Row)
If y = "Hors région Basse-Normandie" Then
Cells(2, 29) = p1 + 1
ElseIf y = "Paris/Région Parisienne" Then
Cells(3, 29) = p2 + 1
ElseIf y = "50 Manche" Then
Cells(3, 29) = p3 + 1
ElseIf y = "61 Orne" Then
Cells(4, 29) = p4 + 1
ElseIf y = "76 Seine-Maritime" Then
Cells(5, 29) = p5 + 1
ElseIf y = "72 Sarthe" Then
Cells(6, 29) = p6 + 1
Else
Cells(7, 29) = p7 + 1
End If
Next y
On Error GoTo 0
Si vous pouviez m'aider merci d'avance