N
natanz
i am missing something. I have a function that takes in a multiselect
listbox and creates a one dimensional array populated with the indices
of the selected items.
Public function LB2Array() as integer
Dim i As Integer
Dim ArrayCount As Integer
ArrayCount = 1
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve LBarray(1 To ArrayCount)
LBarray(ArrayCount) = i
ArrayCount = ArrayCount + 1
End If
Next i
End With
LB2Array = LBarray
End Sub
I am now trying to use that array to do something on my spreadsheet,
for example i have this code in my OK button click sub.
'snippet1
....
For i = 0 To UBound(LB2array)
OV = (LB2array(i) + 4)
.Offset(1, OV).Value = "X"
Next i
when i run this, i get a compile error that says "Expected Array" at
the first line of snippet1 above.
Can anyone help me, put these x's in the right cells?
thanks in advance.
listbox and creates a one dimensional array populated with the indices
of the selected items.
Public function LB2Array() as integer
Dim i As Integer
Dim ArrayCount As Integer
ArrayCount = 1
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve LBarray(1 To ArrayCount)
LBarray(ArrayCount) = i
ArrayCount = ArrayCount + 1
End If
Next i
End With
LB2Array = LBarray
End Sub
I am now trying to use that array to do something on my spreadsheet,
for example i have this code in my OK button click sub.
'snippet1
....
For i = 0 To UBound(LB2array)
OV = (LB2array(i) + 4)
.Offset(1, OV).Value = "X"
Next i
when i run this, i get a compile error that says "Expected Array" at
the first line of snippet1 above.
Can anyone help me, put these x's in the right cells?
thanks in advance.