Listbox - run-time error 380

J

jacobk

Hi,

I have made a form in VBA with 2 listboxes, lstSubrubriek and lstResult with
3 columns.
The selections the user made in lstSubrubriek I want to display in lstResult.
I've done this in a listbox, because the user can order the list in lstResult.

Rather I get the run-time error 380 'Invalid property array index'.
Can anyone help??

See sub below:

Private Sub lstSubrubriek_Change()

Dim intRows As Integer
Dim varItem As Variant

Set lst = lstSubrubriek
intRows = lst.ListCount - 1
LstResult.Clear

For varItem = 0 To intRows

If lst.Selected(varItem) = True Then
With LstResult
.Column(0, varItem) = Nz(lst.Column(0, varItem))
' ** Gives Run-time error 380 Invalid property array index **
End With
End If
Next

End Sub


Thanks a lot!!

JacobK.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?amFjb2Jr?=,
I have made a form in VBA with 2 listboxes, lstSubrubriek and lstResult with
3 columns.
In which application environment and which version of that application?

You use the NZ function, but that's not a general VB function, I don't turn it
up in the Office Object model library. I can only remember seeing that in
Access...
The selections the user made in lstSubrubriek I want to display in lstResult.
I've done this in a listbox, because the user can order the list in lstResult.

Rather I get the run-time error 380 'Invalid property array index'.
Can anyone help??

See sub below:

Private Sub lstSubrubriek_Change()

Dim intRows As Integer
Dim varItem As Variant

Set lst = lstSubrubriek
intRows = lst.ListCount - 1
LstResult.Clear

For varItem = 0 To intRows

If lst.Selected(varItem) = True Then
With LstResult
.Column(0, varItem) = Nz(lst.Column(0, varItem))
' ** Gives Run-time error 380 Invalid property array index **
End With
End If
Next

End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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