VBA & Macro Problems

How to Copy a Source Cell's Fill Color to Another Excel Cell

Natalie TaylorNatalie Taylor Nov 10, 2026 869 views

Question details

The user needs to retrieve and apply the fill color of a source cell to a destination cell in an Excel schedule dynamically, based on formula outputs.

How to Copy a Source Cell's Fill Color to Another Excel Cell
Product
Microsoft Excel
Device & OS
not provided
Scenario
Building a dynamic team schedule where the destination cells must automatically reflect the varying fill colors of the source cells.
Observed behavior
Standard Excel formulas, such as INDEX, only return cell values and cannot retrieve or copy the source cell's fill color or formatting.
Before you start

Standard spreadsheet formulas cannot retrieve cell formatting directly. You must decide whether you prefer using a VBA macro to copy the formatting or relying on third-party custom functions paired with conditional formatting.

Solution 1Recommended

Use a VBA Macro to Copy Cell Formatting

Use a VBA script to evaluate formula references and directly copy the interior color properties from source to destination cells.

This method uses VBA to match the formatting exactly without needing helper cells or external add-ins. Note that the macro must be run manually or configured as an event trigger whenever the source data changes.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Microsoft Visual Basic for Applications window.

2
Create a new Module

Click on 'Insert' in the top menu bar, then select 'Module' to open a new blank coding window.

3
Paste the VBA code

Paste a formatting macro script into the module. For example, write a Sub routine that loops through your destination range, evaluates the formula, and sets the '.Interior.Color' of the destination cell to match the active source cell's '.Interior.Color'.

4
Adjust the cell range

Ensure the range defined in your macro (e.g., Range("D1:E2")) accurately reflects the destination cells in your specific worksheet.

5
Run the macro

Close the VBA Editor. Press Alt + F8 to open the Macro dialog, select your new macro, and click 'Run' to apply the colors.

Use a VBA Macro to Copy Cell Formatting
Enable Macros: Make sure macros are enabled in your Excel Trust Center settings, otherwise the VBA script will not be allowed to run.
Free Microsoft Office alternative

Switch to WPS Office for a Seamless Spreadsheet Experience

If dealing with complex Excel macros and workaround formatting issues is slowing you down, try WPS Office. It provides a lightweight, highly compatible alternative to Microsoft Excel with an intuitive interface, robust VBA support, and built-in formatting tools.

Fully compatible with Microsoft Excel formats (.xlsx, .xls, .xlsm)Supports advanced VBA macros and complex spreadsheet formulasLightweight application that runs smoothly on older devicesFree to download and use with a familiar tabbed interface
microsoft office alternative - wps office

Frequently Asked Questions

Can VLOOKUP or INDEX return a cell's color?

No, standard lookup formulas in Excel only return the underlying value of a cell. They cannot retrieve metadata such as fill color, font style, or borders.

How can I make my VBA macro run automatically when data changes?

You can use the Worksheet_Change event in the VBA Editor. By placing your formatting code inside this specific event, the macro will trigger automatically whenever the specified range of source cells is modified.

Is there a built-in Excel function to get the fill color of a cell?

Excel does not have a modern, built-in function to return a cell's fill color dynamically. You must rely on VBA, the legacy Excel 4.0 macro function GET.CELL, or third-party add-ins to extract color data.