【问题标题】:Vba Error Handling / only intVba 错误处理/仅 int
【发布时间】:2015-11-25 13:29:00
【问题描述】:

我想在Inputbox 中只允许数字并且如果有人键入一个字母错误处理安装条目。变量zahl 后面会用到。

Dim inpt As Integer
Dim zahl As String
inpt = Application.InputBox("Date (YYMM)")
If inpt = False Then Exit Sub
MsgBox inpt
zahl = CInt(inpt)

【问题讨论】:

    标签: vba excel error-handling int


    【解决方案1】:

    InputBoxMSDN Page

    设置类型:=1

    inpt = Application.InputBox(Prompt:="Date (YYMM)", Type:=1)

    这将强制用户在继续之前输入有效数字。

    【讨论】:

      猜你喜欢
      • 2019-03-20
      • 1970-01-01
      • 2020-03-09
      • 1970-01-01
      • 2014-02-20
      • 2017-08-24
      • 2012-03-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多