Robbie mostly writes about Skyrim but also occasionally sheds light on the oddities of Microsoft applications such as Excel and Outlook.
Today, I will be investigating the use of the Format Controls and ActiveX Scroll Bars. A user using a Scroll Bar can use the slide, click on the arrows at either end or click on the bar itself to quickly and easily select the value they desire. This value is then stored in the spreadsheet which can then be displayed immediately on the worksheet and or stored for future use. They are not only easy to use and visually appealing, they also reduce errors and control the users input into your spreadsheet.
Today, we are going to create two Scroll bars, one Form Controls and one an ActiveX Controls Scroll Bar. You can see these below (the Form Control bar is on top).
Form Controls Versus ActiveX Controls Scroll Bars
There are two types of scroll bars, Form Controls and ActiveX Controls:
- Form Controls are simpler to use and configure. Unless you have a need to use an ActiveX Controls scroll bar, I would recommend using Form Controls.
- ActiveX Controls have far more flexibility than Form Controls. Using ActiveX Controls allows you to change the colour and text used, the mouse pointer in your scroll bar among other things. You can also use Visual Basic with ActiveX bars.
Note: ActiveX Controls are not Mac compatible.
The figure below shows the configuration options available for Format Controls scroll bars (left and middle) and ActiveX Controls scroll bars (all three).
Adding the Developer tab
Before beginning, if the Developer tab is not added by default you will need to enable it. To do this:
If you are using Excel 2007:
- Click the Excel button
- Select Excel Options
- Under Popular, check Show Developer tab in the Ribbon
For those using Excel 2010:
- Select the File menu
- Click Options
- Select the Customize Ribbon tab
- Under Main Tabs tick Developer as shown below
Creating and Configuring a Form Controls Scroll Bar in Excel 2007 and Excel 2010
First, we need to create a scroll bar. To do this:
- Click on the Insert button and select Scroll Bar in the Form Controls section. The Insert button can be found on the Developer tab in the Controls group
- The cursor will change to a cross. Left-click and drag to create the dimensions of your scroll bar
Now we have created the scroll bar, we need to configure it:
Configuring a Format Controls Scroll Bar in Excel 2007 and Excel 2010
Right-click the scroll bar and select Format Control
- On the Size tab, you can specify the exact Height and Width (this is extremely useful if you have a number of scroll bars and you want to ensure they are exactly the same size)
- Next, select the Control tab. This has a number of values you will want to adjust to fully configure your scroll bar
- Minimum value: will likely be zero, but change this if it is required to be higher
- Maximum value: as with the minimum, adjust this as required
- Incremental change: if you click the arrows at either end of the scroll bar, how much the number will increase by
- Page change: if you click on the scroll bar itself, how much the number will increase by
- Cell link: This is the cell that displays the number that the user selects when using the scroll bar
- 3-D shading: Enables or disables 3-D shading
Note: Excel 2007 or Excel 2010 does not allow fractions within scroll bars. If you enter 0.5, Excel will change this to 0. If you want to use fractions, you will need to perform additional calculations on the results from the scroll bar.
Now to an example. I want users of my spreadsheet to select the interest rate of the mortgage they are interested in.
- First I create a scroll bar with the following values selected on the Control tab
- I chose to link my scroll bar with $M$3 as I need to convert this number to interest rates going up by .25% from 1 to 1.25 to 1.5 to 1.75 to 2 and so on.
To achieve this, I add a formula to H6 which is the cell above the scroll bar as shown below.
The formula creates the fractions I require (the /100 is because the cell is formatted as a %)
Note: (M4 is the Linked Cell for this Scroll Bar)
Working With ActiveX Controls Scroll Bars in Excel 2007 and Excel 2010
Creating an ActiveX Controls scroll bar is exactly the same as creating a Form Controls bar (except you choose the scroll bar in the ActiveX Controls section via the Insert button).
You also configure an ActiveX Controls bar identically using Format Control as above. Where the ActiveX Controls bar differs is that they have additional options.
- Note: to reconfigure an ActiveX Controls scroll bar, you need to be in design mode. To access this, click on the Design Mode button on the Developer tab in the Controls group.
- Note: Unless you are in design mode, you will not be able to right-click on your scroll bar.
To access the additional options:
- Right-click on your scroll bar while in design mode
- Select Properties
As you can see from the figure above there are a number of options you can configure. A number of these are identical to those we configured when we configured the Form Control bar. The options that are unique to ActiveX Control bars include:
- BackColor: the colour of the scroll bar itself
- ForeColor: the colour of the arrows and the shadow (should you select it)
- MouseIcon: allows you to use a picture as the mouse icon (should you want to)
- MousePointer: allows you to select another pointer other than the default
You can also add Visual Basic code to your ActiveX button by right-clicking the button and selecting View Code.
The Scroll Bar Is a Great Tool
Scroll Bars allow you to control user input which both reduces errors and also improves the user experience. They are visually appealing, and scroll bars are easy and intuitive to use as users are very familiar with them. In this article, I introduced both the Form Controls and ActiveX Controls scroll bar and using an example showed how to create and configure both. The ActiveX Controls bar has more options available compared to the simpler Format Controls bar.
Many thanks for reading; I hope that you found it not only interesting but also informative and useful. Please feel free to leave a comment below.
This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.
© 2013 Robbie C Wilson