Hi all,

i need your help - I have following code:

Sub MitDictionary()
Dim arr
Dim dic
Dim ze As Long
Dim txt As String
Set dic = CreateObject("scripting.dictionary")
arr = Sheets(1).Cells(1, 1).CurrentRegion.Resize(, 2).Value

For ze = 1 To UBound(arr, 1)
    If arr(ze, 1) Like "CUST" Then
        txt = CStr(arr(ze, 2))
    ElseIf arr(ze, 1) Like "REF" Then
        If dic.exists(txt) Then
            dic(txt) = dic(txt) & "&" & arr(ze, 2)
        Else
            dic(txt) = arr(ze, 2)
        End If
    End If
Next

With Sheets(2).Cells(1, 1).Resize(dic.Count)
    .Offset(0, 0).Value = WorksheetFunction.Transpose(dic.keys)
    .Offset(0, 1).Value = WorksheetFunction.Transpose(dic.items)
End With
       
End Sub
Sometime i receive the message : ERROR 13 type mismatch .

How can i solve it ?

Thanks
Marcus