- 32
- 0
- 约1.62千字
- 约 3页
- 2021-09-21 发布于山东
- 举报
excelvba使用inputbox方法详解
excelvba使用inputbox方法详解
excelvba使用inputbox方法详解
excel vba使用 InputBox 方法详解
在 Excel 中输入简单的数据可以使用 InputBox 函数显示的对话框,但是若是输入的数据种类不般配时,过程运行时会产买卖外错误。为了防范此类情况发生,可以使用另一种获得用户输入的方式 ——InputBox 方法。
输入指定种类的数据
使用 InputBox 方法输入数据时可以指定数据的种类,以下面的代码所示。
复制内容到剪贴板
代码 :
#001Sub dInput()
#002 Dim dInput As Double
#003 Dim r As Integer
#004 r = (A65536).End(xlUp).Row
#005 dInput = (Prompt:= 请输入数字: , Type:=1)
#006 If dInput False Then
#007 (r + 1, 1).Value = dInput
#008 Else
#009 MsgBox 你已取消了输入 !
#010 End If
#011End Sub
代码剖析:
dInput 过程使用 InputBox 方法显示一个提示用户输入数字的对话框。 InputBox 方法显示一个接收用户输入的对话框,返回此对话
原创力文档

文档评论(0)