首页 > 解决方案 > 如何将项目添加到列表框

问题描述

我在多个文本框中的用户窗体上有一组数据。

我编写了一个代码来查找是否有一个空白文本框会导致数据表不完整。

如果数据不完整,我希望它获取我的批号(在 中Txtbox10A10)并将批号放在我的列表框中,以便我以后可以访问它以完成数据。

有什么办法可以做到这一点吗?我尝试了多种方法,但有很多错误。

标签: excelvbauserform

解决方案


嗨对不起vba还是新手

我有以下一组代码

enter code here

Dim i As Integer
Dim J As Integer
Dim uppercolJ As Integer
Dim Mistakes As Integer
Dim x As Integer
'    cmas = UserForm3.MultiPage1.Pages(UserForm3.MultiPage1.Value).Controls("Txtbox" & 1 & "A" & J)


Set Form = UserForm3.MultiPage1.Pages(UserForm3.MultiPage1.Value)
uppercolJ = 41
Mistakes = 0
        For J = 28 To uppercolJ
            ActiveTextBoxName = "Txtbox" & 1 & "A" & J

            If UserForm3.MultiPage1.Pages(3).Controls(ActiveTextBoxName) = "" Then
                Mistakes = Mistakes + 1

            Else


    End If
        Next J
         If Mistakes > 0 Then
  MsgBox "Cells are incomplete, saving for later completion"

Else
MsgBox "comp"
'Call save
End If
End Sub`````






now when Mistakes > 0 
then i would like it to save the batch no. of the product which can be found in Txtbox10A10
to a listbox i have created. so that if i come back tomorroww  to finish all my data i can call that information from the batch no. in my listbox,


i have all coding already done just not sure how to get it to add my backnumber to the listbox upon Mistakes > 0

推荐阅读