J.H*_*J.H 2 excel vba types excel-vba
我想查看数据类型是Cells(2, 1).Value什么:即"这里有什么?" 下面.
我尝试了名字(整数/长等),但似乎不接受.
If TypeName(Cells(r, 1).Value) = "WHAT GOES HERE?" Then
MsgBox "Yes"
Else
MsgBox "No"
End If
Run Code Online (Sandbox Code Playgroud)
好好看看MSDN会显示一个可能的返回值表
String Returned Variable
-------------------------------------------------------------------
Object type An object whose type is objecttype
Byte Byte value
Integer Integer
Long Long integer
Single Single-precision floating-point number
Double Double-precision floating-point number
Currency Currency value
Decimal Decimal value
Date Date value
String String
Boolean Boolean value
Error An error value
Empty Uninitialized
Null No valid data
Object An object
Unknown An object whose type is unknown
Nothing Object variable that doesn't refer to an object
Run Code Online (Sandbox Code Playgroud)
此外,您还可以使用内置帮助查看上表(功能归功于Axel Richter).要快速跳转到相应页面,请选择该功能,然后按F1 或通过对象浏览器导航到帮助页面,如下所示: