Greetings. I'm fairly new to coding in VBA, and I've done my best to learn as I go, piece together code snippets, and look up answers to my problem. That said, I'm stuck and I can't figure out these two issues with SpinButtons.
1. I've created a UserForm with five SpinButtons. Their purpose is to increase or decrease the value of the active cell by 0.1, 0.01, 0.001, etc. I also wanted the up/down keyboard arrow keys to function the same as clicking the up or down buttons, and the left/right arrow keys to switch the focus across the buttons. I've got this behavior worked out... mostly. Switching from one SpinButton to another with left/right works fine. Activating the buttons with up/down causes the addition/subtraction to fire twice. Clicking the SpinButtons works as normal. Why does clicking the SpinButton work as desired, but using the arrow keys causes values to be doubly incremented/decremented?
2. The math related to the SpinButtons is written directly in VBA as the digit 1 in the appropriate tenth/hundredth/etc place. Spinning up a certain amount then down the same amount results in changes being made at a MUCH smaller level (using the first button up four times, then down four times results in a value of 2.78E-17). Why is this happening and how can I make it stop?
Bookmarks