Listbox in VBA

G

Guest

Hello,
I want to create a listbox in VBA. I have the error Run-Time #424 with the
following:
Private Sub UserForm1_initialize()
With ListBox1
..AddItem "macro1"
..AddItem "macro2"
..AddItem "macro3"
..AddItem "macro4"
..AddItem "macro5"
End With
End Sub
Thanks,
 
A

Andy Pope

Hi,

The error would suggest that you do not have a control called listbox1
on the userform. Have you renamed the control?

Also the userform initialize event doesn't usually contain the userforms
name. May this should be.

Private Sub UserForm_Initialize()

Cheers
Andy
 

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