ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scroll through items in a drop down from a button. (https://www.excelbanter.com/excel-programming/370468-scroll-through-items-drop-down-button.html)

quartz[_2_]

Scroll through items in a drop down from a button.
 
I am using Office 2003 on Windows XP.

I have a dropdown control on a custom toolbar that is populated with some
items.
I also have a button, which when the user clicks it, I would like the next
item in the drop down to become selected (like a scrolling button), so the
user can quickly scroll through the list, making each next item the item
selected in the drop down.

The user also needs to be able to access the drop down in the customary way.

Can someone please post example code to do this?

Thanks.

Die_Another_Day

Scroll through items in a drop down from a button.
 
Sub IncrementCombo()
With Application.CommandBars("Your ToolBar").Controls("Your ComboBox")
.ListIndex = .ListIndex + 1
End With
End Sub

Try that

Charles
quartz wrote:
I am using Office 2003 on Windows XP.

I have a dropdown control on a custom toolbar that is populated with some
items.
I also have a button, which when the user clicks it, I would like the next
item in the drop down to become selected (like a scrolling button), so the
user can quickly scroll through the list, making each next item the item
selected in the drop down.

The user also needs to be able to access the drop down in the customary way.

Can someone please post example code to do this?

Thanks.



NickHK

Scroll through items in a drop down from a button.
 
You should put a check for the end of the list to start at the top again, or
stop at the bottom

Sub IncrementCombo()
With Application.CommandBars("Your ToolBar").Controls("Your ComboBox")
If .ListIndex = .ListCount-1 then
.ListIndex =0
Else
.ListIndex + 1
End If
End With
End Sub

NickHK

"Die_Another_Day" wrote in message
ups.com...
Sub IncrementCombo()
With Application.CommandBars("Your ToolBar").Controls("Your ComboBox")
.ListIndex = .ListIndex + 1
End With
End Sub

Try that

Charles
quartz wrote:
I am using Office 2003 on Windows XP.

I have a dropdown control on a custom toolbar that is populated with

some
items.
I also have a button, which when the user clicks it, I would like the

next
item in the drop down to become selected (like a scrolling button), so

the
user can quickly scroll through the list, making each next item the item
selected in the drop down.

The user also needs to be able to access the drop down in the customary

way.

Can someone please post example code to do this?

Thanks.






All times are GMT +1. The time now is 08:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com