![]() |
loop through Combobox
Whenever I goto the end of my Combobox (last listnumber) with my Keys, I want the control to goto listindex -1. In another way when I tab into a ComboBox and use my keys to go through the values, I want the control to start all over whenever I reach the last value
Another control I could use is whenever I use my mouse to go through the values, I want the top value to change with the (with mouse) highlighted value |
loop through Combobox
Add this code to your userform
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) With Me.ComboBox1 Select Case KeyCode Case 40 ' : 'down arrow If .ListIndex = .ListCount - 1 Then .ListIndex = -1 End If End Select End With End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "akyhne" wrote in message ... Whenever I goto the end of my Combobox (last listnumber) with my Keys, I want the control to goto listindex -1. In another way when I tab into a ComboBox and use my keys to go through the values, I want the control to start all over whenever I reach the last value. Another control I could use is whenever I use my mouse to go through the values, I want the top value to change with the (with mouse) highlighted value |
loop through Combobox
Only by putting it in a function and call the function from each passing the
combobox as an argument. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "akyhne" wrote in message ... Works great! What if I want to run this code on 13 Comboboxes. Can this be automated so I only write the code once |
All times are GMT +1. The time now is 11:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com