D
donwb
Excel 2003
I have a 2 column, populated ListBox.
The ListBox selection routine includes the code:-
MyIndex = UserForm1.ListBox1.ListIndex
(under <<Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift
As Integer, _
ByVal X As Single, ByVal Y As Single)>>)
and MyIndex is a Publically declared variable.
The purpose of recording the user's selection in the MyIndex variable
is so that it can be used in the UserForm Initialize process to
highlight the last selection.
The Initialize routine therefore includes the code:-
UserForm1.ListBox1.ListIndex = MyIndex
(under <<Private Sub UserForm_Initialize()>>)
When the UserForm/ListBox code is run, I get an error
Runtime Error 380 and
<<Could not set the ListIndex Property. Invalid Property Value.>>
I have used this code in another project and it runs fine.
The only difference is the ListBox in the project that works
has 1 column, whereas the one that fails has 2.
Any ideas would be welcome
donwb
I have a 2 column, populated ListBox.
The ListBox selection routine includes the code:-
MyIndex = UserForm1.ListBox1.ListIndex
(under <<Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift
As Integer, _
ByVal X As Single, ByVal Y As Single)>>)
and MyIndex is a Publically declared variable.
The purpose of recording the user's selection in the MyIndex variable
is so that it can be used in the UserForm Initialize process to
highlight the last selection.
The Initialize routine therefore includes the code:-
UserForm1.ListBox1.ListIndex = MyIndex
(under <<Private Sub UserForm_Initialize()>>)
When the UserForm/ListBox code is run, I get an error
Runtime Error 380 and
<<Could not set the ListIndex Property. Invalid Property Value.>>
I have used this code in another project and it runs fine.
The only difference is the ListBox in the project that works
has 1 column, whereas the one that fails has 2.
Any ideas would be welcome
donwb