View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gert-Jan Gert-Jan is offline
external usenet poster
 
Posts: 49
Default Userform for displaying values from a row

Thanks a lot.
But there is one thing: I didn't mention that it will be better to do it all
in VBA. If there are non-unique items in my range, I will have a problem.

"Die_Another_Day" schreef in bericht
oups.com...
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = ComboBox1.ListCount Then
CommandButton1.Enabled = False
If ComboBox1.ListIndex = 1 Then CommandButton2.Enabled = False
End Sub

Private Sub CommandButton1_Click() 'Next Button
Dim i As Long 'Index
i = ComboBox1.ListIndex
If i < ComboBox1.ListCount Then
ComboBox1.ListIndex = i + 1
If i + 1 = ComboBox1.ListCount Then CommandButton1.Enabled = False
Else
CommandButton1.Enabled = False
End If
End Sub

Private Sub CommandButton2_Click() 'Previous Button
Dim i As Long 'Index
i = ComboBox1.ListIndex
If i 1 Then
ComboBox1.ListIndex = i - 1
If i - 1 = 1 Then CommandButton2.Enabled = False
Else
CommandButton2.Enabled = False
End If
End Sub

I think that would complete the task

Die_Another_Day