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
?
答案 0 :(得分:0)
此错误表示存在类型不匹配。
确保范围实际上包含整数。
mynumber
和myextra
应通过括号括起来声明为数组:
Dim mynumber() As Integer, mysum As Integer, myextra() As Integer