Excel VBA 运行-时间错误“13”值不是数字时类型不匹配
Excel VBA Run-time error '13' Type mismatch when value isnt numerical
当值不是数字时,我有以下代码返回不匹配错误。我会改变什么?
If Sheet3.Cells(4, 8).Value <= 182 Then
Call ThreeSpells
End If
提前致谢:)
像这样
Dim MyVar, MyCheck
MyVar = Sheet3.Cells(4, 8).Value
MyCheck = IsNumeric(MyVar) 'Returns True
If MyCheck = True Then
If Sheet3.Cells(4, 8).Value <= 182 Then
Call ThreeSpells
End If
Else
'msgbox or what you want
End If
当值不是数字时,我有以下代码返回不匹配错误。我会改变什么?
If Sheet3.Cells(4, 8).Value <= 182 Then
Call ThreeSpells
End If
提前致谢:)
像这样
Dim MyVar, MyCheck
MyVar = Sheet3.Cells(4, 8).Value
MyCheck = IsNumeric(MyVar) 'Returns True
If MyCheck = True Then
If Sheet3.Cells(4, 8).Value <= 182 Then
Call ThreeSpells
End If
Else
'msgbox or what you want
End If