- The Clipboard Viewer
- Editing with the Keyboard
- Creating a Data Series
- Creating a Custom Fill Series
- Creating a Custom Fill to Define Linear or Growth Trends
- Creating a Custom List or Series
- Replacing Data
- Tracking Changes Made by Multiple Users
- Using Comments to Explain Cell Content
- Linking Excel Data
- Excel in Practice
Linking Excel Data
So far, all the discussion of moving and copying has referred to content that exists in one or more locations, with no connection between the locations. Copying a section of a worksheet or an entire worksheet to another workbook saves you time and effort, but after the section or sheet is copied, the relationship between the source material and the target location might end (unless formulas are included that create links, as described shortly). If you go back to the source worksheet and change any of the data, the changes are not reflected in the place(s) to which the material was copied.
What if you want to establish a permanent relationship between the source material and the target? What if you need to copy a section of a worksheet to another workbook, and you want changes in the original (source) material to update the target (copied) material as well? To establish such a relationship, you must set up a link between the source and the target. Such a link uses OLE (object linking and embedding), a powerful Windows feature.
If the target workbook will be transferred to or used on another computer or network, be sure to send along the source workbook also, or the link between the files will be broken. Be sure to place the files in folders at the new location that match the folder names at the old location, so that the path between the files remains the same (unless both files are in the same folder, in which case you don't have a problem). You might find that copying both files to the new location and then re-creating the link simplifies this process. See the later section "Breaking Links Between Files" for details.
Establishing Links Between Worksheets or Workbooks
The simple Edit, Paste command places copied content in a new location. Choosing Edit, Paste Special enables you to create a link between the source and target worksheets or workbooks.
You can establish one or more links within a single worksheet, enabling you to enter repeated information once and have it update to one or more additional cells automatically.
To copy and link content between worksheets or workbooks in Excel, follow these steps:
When copying between workbooks, be sure both workbooks are open and have been saved.
Select and copy the source content in the source worksheet. This content will become the linked object.
Move to the target worksheet, select the cell where you want the linked data to begin, and choose Edit, Paste Special to open the Paste Special dialog box (see Figure 3.23).
Make any selections pertaining to the content and formatting you want to include in the pasted material. In most cases, the default All selection is exactly what you need.
Click the Paste Link button. Note that this button doesn't open another dialog box, as you might expect. Instead, it immediately executes the link.
Figure 3.23 In most cases, use the All option that's selected by default when creating a paste link.
After linking a source and target, test the link by switching to the source cells and making a change to their content. Check the target, and see that the change is reflected. When viewing the target, notice that the Formula bar shows the link, listing the source location, as shown in Figure 3.24. The workbook name appears in brackets ([ ]), followed by the worksheet name, and the entire workbook/worksheet name is enclosed in single quotation marks (') and followed by an exclamation point (!) and the range name or cell reference. In this example, the link is as follows:
The source workbook's name is Chapt3.xls (.xls is the file's extension).
The source worksheet is named TABLE.
The source cell is D8.
If the source workbook is closed, the link formula also includes the full path to the source file.
If you paste link blank cells, Excel displays 0 for the blank cell in the target location. To suppress the display of zeros, choose Tools, Options, click the View tab, and deselect the Zero Values option.
Figure 3.24 When a target cell is selected, the Formula bar displays the source filename, sheet name, and cell address.
Updating Links to a Workbook
When you open a workbook that contains one or more links to other workbooks, you'll be prompted to update the linksthat is, update the target to reflect any changes made in the source, as shown in Figure 3.25. You are prompted to update links only when one or more of the source workbooks are closed. If they're all open at the time you open the file containing links, Excel automatically updates the links. If you prefer, you can choose to keep the file's existing content intact and update the links later, as needed.
Figure 3.25 If you aren't the primary editor of the source document, it might be safer to choose No, and then check the source document before updating the linked data.
To update a link between two workbooks after the target has been opened, follow these steps:
In the document containing the linked material (the target), choose Edit, Links to display the Links dialog box.
In the Links dialog box, click the link you want to update in the Source File list (see Figure 3.26).
Click the Update Values button.
Links can be edited only from within the target document. The Links command is disabled in the Edit menu if you attempt to access it from the source document or any unlinked workbook.
Figure 3.26 It's a good idea to save the workbook before updating any links. If you regret having updated them, you can close the file without saving.
To quickly update all links with one fast keystroke, press F9 in the workbook that contains linked data. Note, however, that this technique is useful only when the following conditions are in place:
The workbook containing the links has calculation set to Manual (choose Tools, Options, click the Calculation tab, and select Manual).
The source workbook is open.
Locking Linked External Data
Worksheets can occasionally include links to OLE-compatible applications other than Excel. To prevent accidental updates of these links, you can lock the links. Choose Tools, Options to open the Options dialog box, and click the Calculations tab. Remove the check mark in the Update Remote References box. To resume updates in the future, turn the option back on.
If you rename a workbook to which other workbooks are linked, the links break. You can repair the broken links by redirecting them to the renamed file. To do so, move to the target document (the workbook that contains the links) and choose Edit, Links. Click the Change Source button, and choose the appropriate file from the Change Links dialog box. By default, the cell addresses that were copied will be retained.
Breaking Links Between Files
You can break links by choosing Edit, Links, Break Link. Most broken links occur accidentallythe user changes the name of either the source or target file or moves one or both files to a new folder. Any change in name or location of either the source or target file will result in a broken link.
To establish a new link to another document, you must re-create a link from scratch, starting with copying the source data and using the Edit, Paste Special command to link the source data to the target cells.
You can also replace linked cells or break the link with the values that the cells contain. Copy the linked cell(s), choose Edit, Paste Special, select Values in the Paste Special dialog box, and then choose OK.