VBA

在vb中,要想验证一个数是不是整数,怎么实现啊????

解决方案 »

  1.   

    If Int(数) = 数 Then
        是整数
    Else
        非整数
    End if
      

  2.   


    Dim tmp as string
    tmp="123"
    If IsNumeric(tmp) And InStr(1, tmp, ".", vbTextCompare)=0 Then '是整数
      

  3.   

    '变量本身就是Integer或者Long类型的也可用
    If   VarType(ynum)   =   vbInteger   or   VarType(ynum)   =   vbLong   then'整数
    '另外也可以用正则表达式来做
      

  4.   


    QQ群 48866293 OFFICE应用挖掘 
    MS OFFICE(ACCESS\EXCE\WORD等应用技术探讨与交流!技术群,请阅群论坛中的《踢人规则》当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖