ActiveX controls – SpinButton in Excel VBA

Construction of the application for entering data – Inserting the Knob Button – SpinButton (ActiveX Control) 

The next ActiveX control we will know is the knob button control. We will use it for navigation, and precisely move the rows of the sheet up and down. Our goal is to click on the upper arrow buttons to move the view of the rows one sheet up. If you click the down arrow, the sheet view should move down. How do I insert the SpinButton knob? We go into the tab Developer . From the Insert icon, choose the spinner button and put it over the last column of our table.

 

Building an application for entering data – Programming the SpinButton knob (ActiveX control) 

Due to the fact that the button and all controls of our application are in Sheet1, we also program the knob button in the Sheet1 object in the VisualBasic Editor. Assign the following code to the button by selecting previously the SpinUp and SpinDown triggers :

The arrows on the button should work properly. A single click on the top arrow will move the sheet view up. The program will work the opposite when you click the down arrow. The code of our program in the Arkusz1 object looks like this:

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: