Referencing External Cell Colors

Written by Allen Wyatt (last updated November 30, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


Beth asked how to copy the color formatting of an external cell to a cell in the current workbook. Unfortunately, there is no intrinsic way to do this by using the linking features of Excel. You can, however, copy formatting from one workbook to another by using a macro.

As an example, consider the following macro code:

Workbooks.Open Filename:= "C:\mypath\myworkbook.xls"
Range("A1").Select
Selection.Copy
Windows("TargetBook.xls").Activate
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteFormats, _
  Operation:=xlNone, SkipBlanks:=False, _
  Transpose:=False

This code does several things. First, it opens the external workbook and selects the range of cells you want to copy. The Copy method is then invoked, so the source range is now in the Clipboard. The macro then switches to the target workbook and select the range there. Finally, the PasteSpecial method is used to paste only the format of the source cells.

If you decide to use code like this, you can place it in the Auto_Open macro for the target workbook. Of course, you need to modify the code so that it refers to the proper path and workbook names, along with the desired source and target ranges.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2601) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Automatically Inserting Tomorrow's Date

Do you routinely need to work with tomorrow's date? Why not create a template that automatically adds tomorrow's date to ...

Discover More

Displaying Quick Document Statistics

Need to see how many pages, words, paragraphs, or lines are in your document? Word makes it easy to retrieve such ...

Discover More

Conditional Printing

If you need to make what Excel prints be based upon conditions in a worksheet, you'll love the information in this tip. ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Displaying Negative Percentages in Red

Excel includes quite a few different formats you can use for the information in a worksheet. One format that isn't as ...

Discover More

Easy Value Hiding

Want a quick and easy way to hid the information in a cell? You can do it with a simple three-character custom format.

Discover More

Understanding Cell Indenting

Formatting a cell could, if you desire, also include the indentation of information within the cell. This tip examines ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.