Vba 除非用户输入为空,否则InputBox如何显示

Vba 除非用户输入为空,否则InputBox如何显示,vba,excel,Vba,Excel,我有一个VBA程序,它让用户输入数字或字符串,直到他们想结束程序,所以他们只需按enter键输入一个空字符串,而不必键入任何内容。这就是目标 当我运行此命令时,会出现以下错误: 编译错误: 参数不是可选的 代码如下: Sub enterinputs() inputs = 1 Do While IsEmpty(inputs) = False inputs = InputBox("Enter names of inputs. Leave blank + Enter to stop.

我有一个VBA程序,它让用户输入数字或字符串,直到他们想结束程序,所以他们只需按enter键输入一个空字符串,而不必键入任何内容。这就是目标

当我运行此命令时,会出现以下错误:

编译错误:

参数不是可选的

代码如下:

Sub enterinputs()
inputs = 1
Do While IsEmpty(inputs) = False
    inputs = InputBox("Enter names of inputs. Leave blank + Enter to stop.", title)
    Trim(InputBox.Value & inputs) = inputs
Loop
End Sub
您可以测试是否存在错误:

这将允许您输入要处理的数字以及检测取消或x。

InputBox.Value是输入,但我认为它无论如何都不会工作
Sub WhatIsTruth()
   Dim v As Variant
   v = True

   Do Until v = False
      v = Application.InputBox(Prompt:="Enter Value", Type:=1)
   Loop
End Sub