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:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2601) applies to Microsoft Excel 97, 2000, 2002, and 2003.
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!
Sometimes Excel does things that may appear just plain wacky. This particular tip deals with an issue that could crop up ...
Discover MoreWant some dashes automatically added in values you display in a cell? It may be trickier to develop a custom format than ...
Discover MoreNeed the contents of a cell to be shown in a direction different than normal? Excel makes it easy to have your content ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments