从代码窗口运行时宏运行正常,但是从按钮运行时出现溢出错误

时间:2019-04-18 01:13:37

标签: excel vba

当我从按钮运行宏时,获取运行时错误'6'溢出,但是当我从vba运行宏时,则什么也没有。

Dim sumnands1 As Double
Dim sumnands2 As Double
Dim nands As Double

'sumnands1 = 1070.9915368616
'sumnands2 = 3027.34663906532
sumnands1 = WorksheetFunction.Sum(Range("N4:N369"))
sumnands2 = WorksheetFunction.Sum(Range("O4:O369"))

'the line below is where i am getting an error
nands = 1 - sumnands1 / sumnands2

Worksheets("accuracy").Cells(7, 3) = nands

该按钮的代码仅仅是     呼叫nameofsub

0 个答案:

没有答案