我正在尝试查看我的函数生成的数组的每个值,如果值为 <> 0,则将其放在一个单元格中,但在那个阶段我总是会遇到类型不匹配错误。代码将在写入时在单元格内放置一个值,但我想从集合中清除 0 值并替换为“-”。
Vals0(1 到 30)
Do While (Now - 1) > fdate0
looop0 = 1
Start = DateAdd("n", 450, PT.Range("P2").Value)
Endd = DateAdd("d", 1, Start)
E0.Cells((counter0), 1).Value = fdate0
For looop0 = 1 To 30
vals0(looop0) = Application.Run("PIAdvCalcVal", E0Tags(looop0), Start, Endd, "average (time-weighted)", "time-weighted", "0", "1", "0")
' If Vals0(looop0) <> 0 Then
E0.Cells(counter0, (looop0 + 1)).Value = vals0(looop0)
'Else
' E0.Cells(counter0, (looop0 + 1)).Value = "-"
'End If
Next looop0
counter0 = counter0 + 1
PT.Range("P2").Value = (PT.Range("P2").Value + 1)
fdate0 = PT.Range("P2").Value
Loop