首页 > 解决方案 > 返回 VBA InputBox 的数量?

问题描述

因此,目前在特定条件下,我会弹出此 InputBox 供用户输入注释,然后该框将这些注释填充到单元格中。我想做的是,如果注释已经在 InputBox 正在填充注释的单元格中,这些注释将已经出现在输入字段中,以便用户可以添加到它们。我不知道这是否可以做到,并且在谷歌上找不到任何东西。如果不能这样做,请使用 insted 用户表单。

在此处输入图像描述

当前调出输入框的代码如下,“notes”是 InputBox 填充到的字段:

If InStr(OPs, "Incomplete") > 0 Or InStr(OPs, "Miss") Then
    notes.Interior.Color = RGB(255, 200, 0)
        If notes = "" Then
            Do While notes = ""
                notes = notes & InputBox("You must imput notes for " & Desc & " !", "Notes")
            Loop
        End If
End If

标签: excelvba

解决方案


使用 的Default参数InputBox

就像是:

notes = notes & InputBox("You must input notes for " & Desc & " !", "Notes", notes)

但是,如果你使用它,你不想使用,notes = notes & ...因为字符串字段会很快溢出......所以也许只是:

notes = InputBox("You must input notes for " & Desc & " !", "Notes", notes)

推荐阅读