1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| 'dicos a partir de ma reference : fichier
Function dicotest() As Dictionary
'definition variables
Dim RangeTotal As Range, MyRange As Range
Dim MyDico As New Dictionary
Dim xlsheet As Worksheet
Set xlsheet = ThisWorkbook.Worksheets("")
'Creation dico
With xlsheet
Set RangeTotal = .Range(.Range("").Offset(1), .Range("").End(xlDown))
'creation dico
For Each MyRange In RangeTotal
If Not MyDico.Exists(MyRange.Value) Then
MyDico.Add MyRange.Value, MyRange.offset(1).value & "\" & MyRange.offset(1).value
End If
Next MyRange
End With
'attribution et vidage
Set DicoTest = MyDico
Set MyDico = Nothing
End Function |
Partager