Easy Question

G

Guest

I have the following code:

Private Sub CommandButton7_Click()
UserForm1.ListBox2.Add("A", "B", "C")
End Sub


I am having trouble with line 2. Im not sure how to add the "A", "B" and C
in userform 1 listbox by clicking command button 7.
 
D

Dave Peterson

Is this commandbutton on the same userform as the listbox?

Private Sub CommandButton7_Click()
with me.ListBox2
.Additem "A"
.additem "B"
.additem "C"
end with
End Sub
 
G

Guest

The command button is not in the same userform as the listbox. The command
button is in Userform2 and the listbox2 is in Userform 1. Is this gonna be a
problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top