View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Userform for displaying values from a row

This is one of those "Is Zero a number" things in this case yes Zero is
a number, this accounts for all problems

"- after opening the userform: when I select the first item: I get an
error from VBA."
When the first item is selected the index is Zero, however there is no
Zero row in Excel.

"- when the second item is selected; the button "next" is disabled."
The second item is now "1" therefore we told VBA to disable the button

"- when the last item is selected, the "next" button is still enabled"
The ".ListCount" is a true count, the max Index is Count - 1 so we
never satisfy "=.ListCount"


So to fix all these problems all we have to do is change this line:

i = ComboBox1.ListIndex

to this:

i = ComboBox1.ListIndex + 1 in all 3 subs

Die_Another_Day