1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Option Explicit
Public Sub dico_erreurs()
Dim dernl As Long
Dim c As Range
Dim dico As Scripting.dictionary
Set dico = CreateObject("Scripting.Dictionary")
With ThisWorkbook.Worksheets("lawks")
dernl = .Cells(.Rows.Count, 7).End(xlUp).Row
For Each c In .Range("J2:J" & dernl).SpecialCells(xlCellTypeFormulas, xlErrors)
With c.Offset(0, -3)
If Not dico.Exists(.Value) Then dico.Add .Value, .Value
End With
Next c
End With
MsgBox _
Prompt:="Les codes suivants sont en erreur." & Chr(13) _
& Join(dico.Keys, " - "), _
Buttons:=vbCritical, _
Title:="Codes en erreur."
Set dico = Nothing
End Sub |