Error 2015
,但将相同的字符串粘贴到工作表中会返回预期值。我无法发布生成字符串的所有代码,但失败点是:
tmp_str = eval_arr(row, col)
'this is the string that fails
'tmp_str = "=0.532563*$C$13+0.385719*$D$13+0.387839*$E$13+0.479558*$F$13+0.452192*$J$13+0.528729*$V$13+0.557767*$W$13+0.493665*$X$13+0.460067*$AA$13+0.459862*$AC$13+0.426223*$AD$13+0.368208*$AU$13+0.460067*$AW$13+0.377209*$AX$13+0.44306*$AY$13+0.414292*$BB$13+0.43957*$BC$13"
'this works
ws.Range("I18").value = tmp_str
'If I make tmp_dbl a Variant, I can see the Error 2015
tmp_dbl = ws.Evaluate(tmp_str)
max_weight = WorksheetFunction.Max(max_weight, tmp_dbl)
有人有任何指示或技巧来追踪错误的根源吗?
tmp_dbl = 0.532563 * [C13] + 0.385719 * [D13] + 0.387839 * [E13] + 0.479558 * [F13] _
+ 0.452192 * [J13] + 0.528729 * [V13] + 0.557767 * [W13] + 0.493665 * [X13] _
+ 0.460067 * [AA13] + 0.459862 * [AC13] + 0.426223 * [AD13] + 0.368208 * [AU13] _
+ 0.460067 * [AW13] + 0.377209 * [AX13] + 0.44306 * [AY13] + 0.414292 * [BB13] _
+ 0.43957 * [BC13]