ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Select Next Item in Combo Box (https://www.excelbanter.com/excel-programming/368304-auto-select-next-item-combo-box.html)

ssjody[_5_]

Auto Select Next Item in Combo Box
 

Hi,

I know this is pretty simple but I'm struggling with it. I want to b
able to click on a command button and the combo box automatically jump
to the next item in the list. How can I do this?

Here is some "Hillbilly" code for what I am trying to accomplish:

Private Sub CommandButtonAdd_Click()
Set wa = Me.ComboBoxJumpToPart.Value
Set wb = Range("PartsList")
'find the (wa) .value in (wb)
'and set (wa) to the next item in the (wb) list.
End Sub

Any help is appreciated.
Jod

--
ssjod
-----------------------------------------------------------------------
ssjody's Profile: http://www.excelforum.com/member.php...fo&userid=3339
View this thread: http://www.excelforum.com/showthread.php?threadid=56481


Tom Ogilvy

Auto Select Next Item in Combo Box
 
Private Sub CommandButton1_Click()
Dim idx as Long
idx = Combobox1.ListIndex
if idx < combobox1.Listcount - 1 then
Combobox1.ListIndex = idx + 1
else
Combobox1.ListIndex = 0
end if
end Sub

--
Regards,
Tom Ogilvy


"ssjody" wrote:


Hi,

I know this is pretty simple but I'm struggling with it. I want to be
able to click on a command button and the combo box automatically jumps
to the next item in the list. How can I do this?

Here is some "Hillbilly" code for what I am trying to accomplish:

Private Sub CommandButtonAdd_Click()
Set wa = Me.ComboBoxJumpToPart.Value
Set wb = Range("PartsList")
'find the (wa) .value in (wb)
'and set (wa) to the next item in the (wb) list.
End Sub

Any help is appreciated.
Jody


--
ssjody
------------------------------------------------------------------------
ssjody's Profile: http://www.excelforum.com/member.php...o&userid=33398
View this thread: http://www.excelforum.com/showthread...hreadid=564819



ssjody[_6_]

Auto Select Next Item in Combo Box
 

Worked Perfectly Tom!

Thanks!
Jody


--
ssjody
------------------------------------------------------------------------
ssjody's Profile: http://www.excelforum.com/member.php...o&userid=33398
View this thread: http://www.excelforum.com/showthread...hreadid=564819



All times are GMT +1. The time now is 03:51 PM.

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