- •About the Author
- •About the Technical Editor
- •Credits
- •Is This Book for You?
- •Software Versions
- •Conventions This Book Uses
- •What the Icons Mean
- •How This Book Is Organized
- •How to Use This Book
- •What’s on the Companion CD
- •What Is Excel Good For?
- •What’s New in Excel 2010?
- •Moving around a Worksheet
- •Introducing the Ribbon
- •Using Shortcut Menus
- •Customizing Your Quick Access Toolbar
- •Working with Dialog Boxes
- •Using the Task Pane
- •Creating Your First Excel Worksheet
- •Entering Text and Values into Your Worksheets
- •Entering Dates and Times into Your Worksheets
- •Modifying Cell Contents
- •Applying Number Formatting
- •Controlling the Worksheet View
- •Working with Rows and Columns
- •Understanding Cells and Ranges
- •Copying or Moving Ranges
- •Using Names to Work with Ranges
- •Adding Comments to Cells
- •What Is a Table?
- •Creating a Table
- •Changing the Look of a Table
- •Working with Tables
- •Getting to Know the Formatting Tools
- •Changing Text Alignment
- •Using Colors and Shading
- •Adding Borders and Lines
- •Adding a Background Image to a Worksheet
- •Using Named Styles for Easier Formatting
- •Understanding Document Themes
- •Creating a New Workbook
- •Opening an Existing Workbook
- •Saving a Workbook
- •Using AutoRecover
- •Specifying a Password
- •Organizing Your Files
- •Other Workbook Info Options
- •Closing Workbooks
- •Safeguarding Your Work
- •Excel File Compatibility
- •Exploring Excel Templates
- •Understanding Custom Excel Templates
- •Printing with One Click
- •Changing Your Page View
- •Adjusting Common Page Setup Settings
- •Adding a Header or Footer to Your Reports
- •Copying Page Setup Settings across Sheets
- •Preventing Certain Cells from Being Printed
- •Preventing Objects from Being Printed
- •Creating Custom Views of Your Worksheet
- •Understanding Formula Basics
- •Entering Formulas into Your Worksheets
- •Editing Formulas
- •Using Cell References in Formulas
- •Using Formulas in Tables
- •Correcting Common Formula Errors
- •Using Advanced Naming Techniques
- •Tips for Working with Formulas
- •A Few Words about Text
- •Text Functions
- •Advanced Text Formulas
- •Date-Related Worksheet Functions
- •Time-Related Functions
- •Basic Counting Formulas
- •Advanced Counting Formulas
- •Summing Formulas
- •Conditional Sums Using a Single Criterion
- •Conditional Sums Using Multiple Criteria
- •Introducing Lookup Formulas
- •Functions Relevant to Lookups
- •Basic Lookup Formulas
- •Specialized Lookup Formulas
- •The Time Value of Money
- •Loan Calculations
- •Investment Calculations
- •Depreciation Calculations
- •Understanding Array Formulas
- •Understanding the Dimensions of an Array
- •Naming Array Constants
- •Working with Array Formulas
- •Using Multicell Array Formulas
- •Using Single-Cell Array Formulas
- •Working with Multicell Array Formulas
- •What Is a Chart?
- •Understanding How Excel Handles Charts
- •Creating a Chart
- •Working with Charts
- •Understanding Chart Types
- •Learning More
- •Selecting Chart Elements
- •User Interface Choices for Modifying Chart Elements
- •Modifying the Chart Area
- •Modifying the Plot Area
- •Working with Chart Titles
- •Working with a Legend
- •Working with Gridlines
- •Modifying the Axes
- •Working with Data Series
- •Creating Chart Templates
- •Learning Some Chart-Making Tricks
- •About Conditional Formatting
- •Specifying Conditional Formatting
- •Conditional Formats That Use Graphics
- •Creating Formula-Based Rules
- •Working with Conditional Formats
- •Sparkline Types
- •Creating Sparklines
- •Customizing Sparklines
- •Specifying a Date Axis
- •Auto-Updating Sparklines
- •Displaying a Sparkline for a Dynamic Range
- •Using Shapes
- •Using SmartArt
- •Using WordArt
- •Working with Other Graphic Types
- •Using the Equation Editor
- •Customizing the Ribbon
- •About Number Formatting
- •Creating a Custom Number Format
- •Custom Number Format Examples
- •About Data Validation
- •Specifying Validation Criteria
- •Types of Validation Criteria You Can Apply
- •Creating a Drop-Down List
- •Using Formulas for Data Validation Rules
- •Understanding Cell References
- •Data Validation Formula Examples
- •Introducing Worksheet Outlines
- •Creating an Outline
- •Working with Outlines
- •Linking Workbooks
- •Creating External Reference Formulas
- •Working with External Reference Formulas
- •Consolidating Worksheets
- •Understanding the Different Web Formats
- •Opening an HTML File
- •Working with Hyperlinks
- •Using Web Queries
- •Other Internet-Related Features
- •Copying and Pasting
- •Copying from Excel to Word
- •Embedding Objects in a Worksheet
- •Using Excel on a Network
- •Understanding File Reservations
- •Sharing Workbooks
- •Tracking Workbook Changes
- •Types of Protection
- •Protecting a Worksheet
- •Protecting a Workbook
- •VB Project Protection
- •Related Topics
- •Using Excel Auditing Tools
- •Searching and Replacing
- •Spell Checking Your Worksheets
- •Using AutoCorrect
- •Understanding External Database Files
- •Importing Access Tables
- •Retrieving Data with Query: An Example
- •Working with Data Returned by Query
- •Using Query without the Wizard
- •Learning More about Query
- •About Pivot Tables
- •Creating a Pivot Table
- •More Pivot Table Examples
- •Learning More
- •Working with Non-Numeric Data
- •Grouping Pivot Table Items
- •Creating a Frequency Distribution
- •Filtering Pivot Tables with Slicers
- •Referencing Cells within a Pivot Table
- •Creating Pivot Charts
- •Another Pivot Table Example
- •Producing a Report with a Pivot Table
- •A What-If Example
- •Types of What-If Analyses
- •Manual What-If Analysis
- •Creating Data Tables
- •Using Scenario Manager
- •What-If Analysis, in Reverse
- •Single-Cell Goal Seeking
- •Introducing Solver
- •Solver Examples
- •Installing the Analysis ToolPak Add-in
- •Using the Analysis Tools
- •Introducing the Analysis ToolPak Tools
- •Introducing VBA Macros
- •Displaying the Developer Tab
- •About Macro Security
- •Saving Workbooks That Contain Macros
- •Two Types of VBA Macros
- •Creating VBA Macros
- •Learning More
- •Overview of VBA Functions
- •An Introductory Example
- •About Function Procedures
- •Executing Function Procedures
- •Function Procedure Arguments
- •Debugging Custom Functions
- •Inserting Custom Functions
- •Learning More
- •Why Create UserForms?
- •UserForm Alternatives
- •Creating UserForms: An Overview
- •A UserForm Example
- •Another UserForm Example
- •More on Creating UserForms
- •Learning More
- •Why Use Controls on a Worksheet?
- •Using Controls
- •Reviewing the Available ActiveX Controls
- •Understanding Events
- •Entering Event-Handler VBA Code
- •Using Workbook-Level Events
- •Working with Worksheet Events
- •Using Non-Object Events
- •Working with Ranges
- •Working with Workbooks
- •Working with Charts
- •VBA Speed Tips
- •What Is an Add-In?
- •Working with Add-Ins
- •Why Create Add-Ins?
- •Creating Add-Ins
- •An Add-In Example
- •System Requirements
- •Using the CD
- •What’s on the CD
- •Troubleshooting
- •The Excel Help System
- •Microsoft Technical Support
- •Internet Newsgroups
- •Internet Web sites
- •End-User License Agreement
CHAPTER
Enhancing Your Work with Pictures and Drawings
When it comes to visual presentation, Excel has a lot more up its sleeve than charts. As you may know, you can insert a wide variety of graphics into your worksheet to add pizzazz to an
otherwise boring report.
This chapter describes the non–chart-related graphic tools available in Excel. These tools consist of Shapes, SmartArt, WordArt, and imported or pasted images. In addition to enhancing your worksheets, you’ll find that working with these objects can be a nice diversion. When you need a break from crunching numbers, you might enjoy creating an artistic masterpiece using Excel’s graphic tools.
On the CD
Most of the examples in this chapter are available on the companion CD-ROM. n
Using Shapes
Microsoft Office, including Excel, provides access to a variety of customizable graphic images known as Shapes. You might want to insert shapes to create diagrams, store text, or just add some visual appeal to a worksheet.
IN THIS CHAPTER
Inserting and customizing Shapes
An overview of SmartArt and WordArt
Working with other types of graphics
517
Part III: Creating Charts and Graphics
Inserting a Shape
You can add a Shape to a worksheet’s draw layer by choosing Insert Illustrations Shapes, which opens the Shapes gallery, shown in Figure 22.1. Shapes are organized into categories, and the category at the top displays the Shapes that you’ve used recently. To insert a Shape on a worksheet, you can do one of the following:
•Click the Shape in the Shapes gallery and then click in the worksheet. A default-sized shape is added to your worksheet.
•Click the Shape and then drag in the worksheet to create a larger or smaller Shape, or a Shape with different proportions than the default
When you release the mouse button, the object is selected, and its name appears in the Name field (as shown in Figure 22.2).
FIGURE 22.1
The Shapes gallery.
518
Chapter 22: Enhancing Your Work with Pictures and Drawings
FIGURE 22.2
This Shape was drawn on the worksheet. Its name (Quad Arrow 1) appears in the Name field.
Tip
You can also insert a Shape into a chart. Just select the chart before you choose the Shape from the gallery and then click inside the chart to insert the Shape. When a chart is selected, the Chart Tools contextual tab also displays an icon to access the Shapes gallery: Chart Tools Layout Insert Shapes. n
A few Shapes require a slightly different approach. For example, when adding a FreeForm Shape (from the Lines category), you can click repeatedly to create lines. Or click and drag to create a nonlinear shape. Double-click to finish drawing and create the Shape. The Curve and Scribble Shapes (in the Lines category) also require several clicks while drawing.
Here are a few tips to keep in mind when creating Shapes:
•Every Shape has a name. Some have generic names like Shape 1 and Shape 2, but others are given more descriptive names (for example, Rectangle 1). To change the name of a Shape, select it, type a new name in the Name field, and press Enter.
•To select a specific shape, type its name in the Name field and press Enter.
•When you create a Shape by dragging, hold down the Shift key to maintain the object’s default proportions.
•You can control how objects appear onscreen in the Advanced tab of the Excel Options dialog box (File Excel). This setting appears in the Display Options for This Workbook section. Normally, the All option is selected under For Objects Show. You can hide all objects by choosing Nothing (Hide Objects). Hiding objects may speed things up if your worksheet contains complex objects that take a long time to redraw.
519
Part III: Creating Charts and Graphics
About the Drawing Layer
Every worksheet and chart sheet has a drawing layer. This invisible surface can hold Shapes, SmartArt, WordArt, graphic images, embedded charts, inserted objects, and so on.
You can move, resize, copy, and delete objects placed on the drawing layer, with no effect on any other elements in the worksheet. Objects on the drawing layer have properties that relate to how they’re moved and sized when underlying cells are moved and sized. When you right-click a graphic object and choose Size and Properties from the shortcut menu that appears, you get a tabbed dialog box. Click the Properties tab to adjust how the object moves or resizes with its underlying cells. Your choices are as follows:
•Move and Size with Cells: If this option is selected, the object appears to be attached to the cells beneath it. For example, if you insert rows above the object, the object moves down. If you increase the column width, the object gets wider.
•Move But Don’t Size with Cells: If this option is selected, the object moves whenever rows or columns are inserted, but it never changes its size when you change row heights or column widths.
•Don’t Move or Size with Cells: This option makes the object completely independent of the underlying cells.
The preceding options control how an object is moved or sized with respect to the underlying cells.
Excel also lets you attach an object to a cell. To do so, open the Excel Options dialog box, click the Advanced tab, and select the Cut, Copy, and Sort Inserted Objects With Their Parent Cells check box. After you do so, graphic objects on the drawing layer are attached to the underlying cells. If you copy a range of cells that includes an object, the object is also copied. Note that this is a general option that affects all objects and, by default, this option is enabled.
Adding text to a Shape
Many Shape objects can display text. To add text to such a Shape, select the Shape and start typing the text.
To change the formatting for all text in a Shape, Ctrl-click the Shape object. You can then use the formatting commands on the Home tab of the Ribbon. To change the formatting of specific characters within the text, select only those characters, and use the Ribbon buttons. Or, right-click and use the Mini toolbar to format the text.
In addition, you can dramatically change the look of the text by using the tools in the Drawing Tools Format WordArt Styles group. You can read more about WordArt later in the chapter.
Formatting Shapes
When you select a Shape, the Drawing Tools Format contextual tab is available, with the following groups of commands:
520
Chapter 22: Enhancing Your Work with Pictures and Drawings
•Insert Shapes: Insert new Shapes; change a Shape to a different Shape.
•Shape Styles: Change the overall style of a Shape; modify the Shape’s fill, outline, or effects.
•WordArt Styles: Modify the appearance of the text within a Shape.
•Arrange: Adjust the “stack order” of Shapes, align Shapes, group multiple Shapes, and rotate Shapes.
•Size: Change the size of a Shape.
Additional commands are available from the Shape’s shortcut menu (which you access by rightclicking the Shape). In addition, you can use your mouse to perform some operations directly: for example, resize or rotate a Shape.
Selecting and Hiding Objects
An easy way to select an object is to use the Selection and Visibility task pane. Just select any Shape and then choose Drawing Tools Format Arrange Selection Pane. Or, choose Home Editing Find & Select Selection Pane.
Like with all task panes, you can undock this pane from the side of the window and make it freefloating. The accompanying figure shows the Selection and Visibility task pane as a floating window.
Each object on the active worksheet is listed in the Selection and Visibility pane. Just click the object’s name to select it. To select multiple objects, press Ctrl while you click the names.
To hide an object, click the “eye” icon to the right of its name. Use the buttons at the bottom of the task pane to quickly hide (or show) all items.
521
Part III: Creating Charts and Graphics
Figure 22.3 shows a worksheet with some Shapes that use various types of formatting.
As an alternative to the Ribbon, you can use the Format Shape dialog box. Right-click the Shape and choose Format Shape from the shortcut menu. You’ll get a stay-on-top tabbed dialog box that contains some additional formatting options that aren’t on the Ribbon. Changes appear immediately, and you can keep the Format Shape dialog box open while you work.
I could probably write 20 pages about formatting Shapes, but it would be a waste of paper and certainly not a very efficient way of learning about Shape formatting. The best way, by far, to learn about formatting Shapes is to experiment. Create some shapes, click some commands, and see what happens. The commands are fairly intuitive, and you can always use Undo if a command doesn’t do what you expected it to do.
FIGURE 22.3
A variety of Shapes.
Grouping objects
Excel lets you combine (or group) two or more Shape objects into a single object. For example, if you create a design that uses four separate Shapes, you can combine them into a group. Then, you can manipulate this group as a single object (move it, resize it, apply formatting, and so on).
To group objects, press Ctrl while you click the objects to be included in the group. Then rightclick and choose Group Group from the shortcut menu.
When objects are grouped, you can still work with an individual object in the group. Click once to select the group; then click again to select the object.
To ungroup a group, right-click the group object and choose Group Ungroup from the shortcut menu. This command breaks the object into its original components.
522
Chapter 22: Enhancing Your Work with Pictures and Drawings
Aligning and spacing objects
When you have several objects on a worksheet, you may want to align and evenly space these objects. You can, of course, drag the objects with your mouse (which isn’t very precise). Or, you can use the navigation arrow keys to move a selected object one pixel at a time. The fastest way to align and space objects is to let Excel do it for you.
To align multiple objects, start by selecting them (press Ctrl and click the objects). Then use the tools in the Drawing Tools Format Arrange Align drop-down list.
Note
Unfortunately, you can’t specify which object is used as the basis for the alignment. When you’re aligning objects to the left (or right), they’re always aligned with the leftmost (or rightmost) object that’s selected. When you’re aligning objects to the top (or bottom), they’re always aligned with the topmost (or bottommost) object. Aligning the centers (or middles) of objects will align them along an axis halfway between the left and right (or top and bottom) extremes of the selected shapes. n
You can instruct Excel to distribute three or more objects so that they’re equally spaced horizontally or vertically. Choose Drawing Tools Format Arrange Align and then select either Distribute Horizontally or Distribute Vertically.
Reshaping Shapes
Excel has many Shapes to choose from, but sometimes the Shape you need isn’t in the gallery. In such a case, you may be able to modify one of the existing shapes using one of these techniques:
•Rotate the Shape. When you select a Shape, it displays a small green dot. Click and drag this dot to rotate the Shape.
•Group multiple Shapes. You may be able to create the Shape you need by combining two or more Shapes and then grouping them. (See “Grouping objects,” earlier in this chapter.)
•Reconfigure the Shape. Many Shapes display one or more small yellow diamonds when the Shape is selected. You can click and drag this diamond to change the Shape’s outline. The exact behavior varies with the Shape, so you should experiment and see what happens. Figure 22.4 shows six variations of an up-down arrow. This particular shape, when selected, has two yellow diamonds, which allows lots of variations.
•Create a Freeform Shape. Select the Freeform Shape (in the Lines category of the Shapes gallery) to create a custom Shape. Figure 22.5 shows a Freeform Shape, with eyes and a mouth added. The shadow effect completes the masterpiece.
•Editing a Shape’s Points. Another way to create a unique Shape is to edit its points. Select the Shape and choose Drawing Tools Format Insert Shapes Edit Shape Edit Points. You can then drag the points to reconfigure the Shape. Figure 22.6 shows an example of a Shape that has been edited beyond all recognition.
523
Part III: Creating Charts and Graphics
FIGURE 22.4
Six variations on a Shape.
FIGURE 22.5
When none of the existing Shapes will do, create your own Freeform Shape.
Printing objects
By default, objects are printed along with the worksheet. To avoid printing a Shape, right-click the Shape and choose Size and Properties. In the Format Shape dialog box, click the Properties tab and then clear the Print Object check box.
524