字典计算错误产生整数

时间:2017-07-24 15:03:19

标签: vba

我有一个创建字典的函数,在我有一个唯一标识的键上,而在值上我想做一个sumif,但是这些值被检索为E-的整数,因此我不能做我需要做的值,我可以通过任何方式得到.000245作为svalue的结果?

Public Sub Createdic(ws As Worksheet, ary, dic)
Dim y, skey, svalue
Dim key As Variant

    'Early binding: add reference to MS Scripting Runtime

    On Error Resume Next
    'populate fund list

    For y = LBound(ary) To UBound(ary)
        If ary(y) <> "" Then
            skey = Trim(ary(y))
            svalue = ((WorksheetFunction.SumIf(ws.range(letter(ws, "Security Name") & ":" & letter(ws, "Security Name")), ary(y), ws.range(letter(ws, "Base Market Value") & ":" & letter(ws, "Base Market Value"))) / Sheets("Input Sheet").range("TNA").value))
            dic.Add svalue, skey
        End If
    Next y

End Sub

现在 svalue = 4.20391436648078E-05

我想要什么 svalue = 0.004203194%

0 个答案:

没有答案