如果 x 是 VBA 语言中的整数,我该如何表达这个术语? [英] how do I express the term if x is integer in VBA language?

查看:26
本文介绍了如果 x 是 VBA 语言中的整数,我该如何表达这个术语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果 x 是 VBA 语言中的整数,我该如何表达这个术语?我想编写一个代码,如果 x 是整数,则执行某些操作,如果它不是 vba excel,则执行其他操作.

how do I express the term if x is integer in VBA language ? I want to write a code that does something if x is integer and does something else if its not with vba excel.

Sub dim()
  Dim x is Variant

  'if x is integer Then 

  'Else:

End Sub 

推荐答案

If IsNumeric(x) Then 'it will check if x is a number

如果你想检查类型,你可以使用

If you want to check the type, you could use

If TypeName(x) = "Integer" Then

这篇关于如果 x 是 VBA 语言中的整数,我该如何表达这个术语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆