A
Alicia
Guest
Bonsoir le forum,
La macro suivante que j'ai récuperé dans le forum m'est trés pratique.
Cependant, comment faire pour ne pas qu'elle me compte les cellules vides ?
Option Explicit
Sub recenser()
Dim coll As Collection
Dim cellule As Range
Dim cptr As Byte, lig As Byte
Application.ScreenUpdating = False
Range("B16:C42").ClearContents
Set coll = New Collection
For Each cellule In Range("tablo")
On Error Resume Next
coll.Add cellule.Value, cellule.Value
On Error GoTo 0
Next
cptr = 1
lig = 16
Do While cptr <= coll.Count
Cells(lig, 2) = coll(cptr)
Cells(lig, 3) = Application.CountIf(Range("tablo"), coll(cptr))
cptr = cptr + 1
lig = lig + 1
Loop
End Sub
Merci de votre aide.
Alicia
La macro suivante que j'ai récuperé dans le forum m'est trés pratique.
Cependant, comment faire pour ne pas qu'elle me compte les cellules vides ?
Option Explicit
Sub recenser()
Dim coll As Collection
Dim cellule As Range
Dim cptr As Byte, lig As Byte
Application.ScreenUpdating = False
Range("B16:C42").ClearContents
Set coll = New Collection
For Each cellule In Range("tablo")
On Error Resume Next
coll.Add cellule.Value, cellule.Value
On Error GoTo 0
Next
cptr = 1
lig = 16
Do While cptr <= coll.Count
Cells(lig, 2) = coll(cptr)
Cells(lig, 3) = Application.CountIf(Range("tablo"), coll(cptr))
cptr = cptr + 1
lig = lig + 1
Loop
End Sub
Merci de votre aide.
Alicia