请问要怎么判断一个变量为整数等等的
有很多种方法可以判别,下面介绍几种:
'1
If Fix(n) = n Then
'为整数
End If
'2
If InStr(CStr(n), ".") = 0 Then
'为整数
End If
'3
If VarType(n) = vbInteger Then
'为整数
End If
'1
If Fix(n) = n Then
'为整数
End If
'2
If InStr(CStr(n), ".") = 0 Then
'为整数
End If
'3
If VarType(n) = vbInteger Then
'为整数
End If
温馨提示:答案为网友推荐,仅供参考