How to allow the arrows buttons on a listbox to change the selection?

joeblow7

New Member
Joined
Jun 27, 2017
Messages
33
Office Version
  1. 365
I have a listbox that is linked to a cell. Right now when I use the arrow keys on the keyboard the value in the cell changes. When I use the scroll bar up and down buttons it just scrolls the items in the list, but doesn't update the cell. Maybe a listbox isn't the best way to go about it? I thought about adding a spin button to the listbox as well, but since you can't hide the vertical scroll bar that doesn't really work. I tried doing:
Code:
 With Sheet2.ListBox1
  .AddItem "0"
     .
     .
     .
     If .ListIndex > -1 Then .Selected(.ListIndex) = True
     End With

but that doesn't change anything, as the buttons aren't changing the selection. There has to be an easy way to allow the up and down arrows on the box to control the selection right?
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top