User Interface Drawing TechniquesUsing Borders to Create Special EffectsTo keep the user focused on the elements of your worksheet user interface, it is often helpful to modify the normal style so all unused areas of the worksheet have a consistent, light gray background color. This practice has been demonstrated in most of the user interface examples shown so far and will be used in our sample application. On top of this light gray background, you can use cell borders to create some interesting special effects. One of the most commonly used border-based special effects gives a range of cells a 3D appearance, either raised or sunken. Figure 4-13 shows examples of both effects. Figure 4-13. Using Borders to Create 3D Visual Effects![]() Figure 4-14. Using Borders to Simulate Gridlines![]() Creating Well-Formatted TablesTables used within an Excel worksheet user interface typically have one or more of the following elements:Table descriptionRow and column descriptionsData-entry areaFormula result area Each section of your table should be formatted with a unique style that you use consistently throughout your user interface. Figure 4-15 shows a sample table with all four of the elements described above. Figure 4-15. A Basic Worksheet User Interface Table Layout![]() Figure 4-16. A Fully Formatted Worksheet User Interface Table![]() Cell Comments for Help TextCell comments are one of the most important user interface features provided by Excel. Their utility stems from the fact that in many cases they can serve the same purpose as a help file without requiring users to do anything more complicated than hover their mouse cursor over the commented cell. Note that cell comments have several limitations that may make them inappropriate in certain situations:If you are using the freeze panes feature on a worksheet and the worksheet is scrolled beyond the freeze point, if the comment window overlaps the frozen row and/or column it will be cut off at the point where the window is frozen.Each cell comment is also associated with a specific status bar message whose structure cannot be modified. The status bar message displayed when users hover their mouse over a comment has the following structure, which is shown graphically in Figure 4-17: Figure 4-17. The Format of an Excel Comment Status Bar Message![]() Figure 4-18. A Rich-Text-Formatted Cell Comment![]() Using ShapesThe ability to use shapes (objects drawn using the various options on the Drawing or Forms toolbars) on an Excel worksheet is a very powerful user interface technique. Shapes are located in a special drawing layer that exists above the cells on a worksheet, so shapes cover (and obscure) worksheet cells. Shapes are also connected to the underlying worksheet through their properties, which allow them to do the following:Move and size with the worksheet cells they coverMove but don't size with the worksheet cells they coverDon't move or size with the worksheet cells they cover Almost all shapes can contain text. A shape's text can either be manually entered or it can be linked dynamically to a specific cell on a worksheet by selecting the shape and entering the address of that cell as a formula in the formula bar. As you can imagine, the ability to assign formulas to shapes opens up a wide array of options for creating dynamic user interfaces. Shapes can also be given a macro assignment that will cause them to execute the specified macro whenever the user clicks them. Just right-click over the shape and choose Assign Macro from the shortcut menu. Figure 4-19 shows an excellent example of how shapes can be used to create a custom toolbar-like area across the top of a worksheet user interface. Figure 4-19. A Custom On-Sheet Toolbar Created with Shapes[View full size image] ![]() |