Thread: add to listbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] steonken@web.de is offline
external usenet poster
 
Posts: 5
Default add to listbox

hi ranswrt,
you need AddItem to create a new row in the listbox. try

With ListBox1
.AddItem
For i = 0 To 6
.List(num, i) = aitem(num, i)
Next
End With

stefan

On 25 Apr., 13:46, ranswrt wrote:
I have a form with a listbox with 7 columns and I want add items to the
listbox using textboxes and a commandbutton. *when I click the commandbutton
to add the items in the textboxes to the end of the items in the listbox I
get an error. *the code that I have tried is :

*For i = 0 To 6
* * * * * * * * With ListBox1
* * * * * * * * * * .List(num, i) = aitem(num, i)
* * * * * * * * End With
* * * * * * Next

I get a 'type mismatch error.
What is the best way to enter new items to the end of an existing list of
items in a listbox that has 7 columns?
Thanks