运行时错误13

时间:2013-11-03 12:19:38

标签: excel-vba runtime-error vba excel

Option Explicit

Sub value()

    Dim mynumber As Integer, mysum As Integer, myextra As Integer
    mynumber = Range("A2:A17")
    myextra = Range("B2:B17")
    mysum = mynumber * myextra
    MsgBox ("mysum")

End Sub

为什么我会获得Run time Error 13

1 个答案:

答案 0 :(得分:0)

此错误表示存在类型不匹配。

确保范围实际上包含整数。

mynumbermyextra应通过括号括起来声明为数组:

Dim mynumber() As Integer, mysum As Integer, myextra() As Integer