ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activate Spin Buttons with Keys (https://www.excelbanter.com/excel-programming/371071-activate-spin-buttons-keys.html)

Donny[_3_]

Activate Spin Buttons with Keys
 
Pretty Simple I think, I'm just learning VBA. I want to be able to
control two different spin buttons with 4 different keys. (ex. i key is
up, k key is down on one spin button, j key is left and L key is right
on the other spin button. I already have some code written for these
buttons, I would just like to hit a key rather than clicking the
buttons. Also, I want to be able to hold down the key just like
clicking and holding.


[email protected]

Activate Spin Buttons with Keys
 
Hi Donny,

'try this :
Sub getStarted()
Application.OnKey "j", "SpinDown"
End Sub

'your code goes here
Sub SpinDown()
ActiveCell.Offset(1, 0).Activate
End Sub

'to end "j" onkey
Sub getTidy()
Application.OnKey "j"
End Sub

Rgds,

Halim


Donny menuliskan:
Pretty Simple I think, I'm just learning VBA. I want to be able to
control two different spin buttons with 4 different keys. (ex. i key is
up, k key is down on one spin button, j key is left and L key is right
on the other spin button. I already have some code written for these
buttons, I would just like to hit a key rather than clicking the
buttons. Also, I want to be able to hold down the key just like
clicking and holding.




All times are GMT +1. The time now is 07:12 PM.

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