VBA词典结果不能正确返回

我正在尝试使用字典来查找column F column C 键值 column C column F
但结果不会像我想要的那样回报。 它显示“0”

场景:
column C 将具有多个相同的值
2.我想根据按键总结column F所有 ,并返回到"RAW" Range("C2")

 "Sheet2" 

这个数据库

 "RAW" 

这是我想查找的地方

请帮帮我。
提前致谢。
在这里我的代码。

 Option Explicit Private Lrow As Long Private oDict As Object Private Sub CreateDict() Dim arrValues As Variant, oKey As Variant, oValue As Variant, i As Long 'Find Master Item List Japan Dim Master As Workbook Dim t As Workbook For Each t In Workbooks If Left(t.Name, 16) = "Master Item List" Then Set Master = Workbooks(t.Name) End If Next t Set oDict = Nothing If oDict Is Nothing Then Set oDict = New Scripting.Dictionary End If ' Add items to the dictionary ' Load values of used range to memory arrValues = Master.Sheets("Sheet2").UsedRange.Value ' Assuming the Key is on first column and Value is on next For i = 2 To UBound(arrValues) oKey = arrValues(i, 3) oValue = arrValues(i, 6) If Len(oKey) > 0 Then If oDict.Exists(oKey) Then ' Append Value to existing key oDict(oKey) = oDict(oKey) + oValue Else ' Add Key and value oDict(oKey) = oValue End If End If Next i End Sub Function GetList(ByVal oRange As Range) As Variant If oDict Is Nothing Then CreateDict ' Static oDict As Scripting.Dictionary 'precerved between calls If oDict.Exists(oRange.Value) Then GetList = oDict.Item(oRange.Value) ' Else ' GetList = 0 End If End Function 

仅供参考。
这是我在其他工作簿中使用的代码,并且很好地工作

 Option Explicit Private lRow As Long Private oDict As Object Private Sub CreateDict() Dim arrValues As Variant, oKey As Variant, oValue As Variant, i As Long 'Find Master Item List Japan Dim Master As Workbook Dim t As Workbook For Each t In Workbooks If Left(t.Name, 16) = "Master Item List" Then Set Master = Workbooks(t.Name) End If Next t Set oDict = Nothing If oDict Is Nothing Then Set oDict = New Scripting.Dictionary End If ' Add items to the dictionary ' Load values of used range to memory arrValues = Master.Sheets("Sheet2").UsedRange.Value ' Assuming the Key is on first column and Value is on next For i = 1 To UBound(arrValues) oKey = arrValues(i, 3) oValue = arrValues(i, 6) If Len(oKey) > 0 Then If oDict.Exists(oKey) Then ' Append Value to existing key oDict.Item(oKey) = oDict.Item(oKey) Else ' Add Key and value oDict.Add oKey, oValue End If End If Next End Sub Function GetList(ByVal oRange As Range) As Long If oDict Is Nothing Then CreateDict ' Static oDict As Scripting.Dictionary 'precerved between calls If oDict.Exists(oRange.Value) Then GetList = oDict.Item(oRange.Value) Else GetList = 0 End If End Function 

编辑#1:
基于@ YowE3k评论我尝试执行GetFile函数并得到如下图所示的结果。
不知道为什么最后一个返回0

这可能是因为它在我的字典历史中已经有了相同的密钥,因为在其他工作簿中我使用了相同的密钥。

结果与代码