---- ANOTHER EDIT -----
I'll try to sum up the whole thing to you guys, than maybe someone can help me.
Although the
and the
works on this listbox, depending on which list item I'm trying to select It just won't work.
Whenever I try to use variables insted of the "1", it won't work, mostly the times or situations.
If I try to run any operation with the variable it just won't work (Like A UserForm.ListBox.ListCount - 1, wouldn't work)
Whenever I try to select the last item it won't work
-----------------------------------
Hi Guys..
I'm having this unusual trouble with the listindex property of a listbox on an userform.
The code below search for a range and refreshes the listbox with the range values.
The sub routine that I'm fireing in the midle of the code above can be seen here:
On my form, I got 2 command buttons which I use to change the position of an Item on the predeterminated range and, I fire the listbox refreshing code.
One of the buttons, sends the selected listindex up and the other one sends it down.
the "send up" code can be seen here:
The thing is, as you can see, the LiCache variable, which can be seen in the last line of the code above, is the ListIndex of the selected item after I changed its position up (ex.: ListIndex - 1), and, in the first code I wrapped, I try to keep the previously selected item still selected.
I have oftenly used this kind of control on my listboxes, but this time IT JUST DOESN'T WORK.
I have tested it so many times and it even stores the right value in the LiCache variable and also changes the listbox.listindex to the desired value, but it doesn't select the item.
I hope I made myself clear.
Thanks for your attention.
Att. Daniel
--------- EDIT -----------
The UserForm can be seen on the attached picture. The two buttons I was Talking about are the /\ and \/ last two.
Bookmarks