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.
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.
Learn more about Allen...
Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Referencing External Cell Colors.
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.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2601) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Referencing External Cell Colors.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!