VBA & Macro Problems

Find Exact RGB Values for Excel 2019 Theme Colors Using VBA

Khadija KhanKhadija Khan Oct 26, 2026 869 views

Question details

The user needs to retrieve and apply the exact RGB values of Excel 2019 theme colors to ensure backward compatibility for assignments or specific projects.

Find Exact RGB Values for Excel 2019 Theme Colors
Product
Excel
Device & OS
not provided
Scenario
Working on assignments that strictly require Excel 2019 theme colors, which are not readily available in the standard color palettes of newer Office versions.
Observed behavior
Because theme colors vary between Office versions, applying standard colors results in discrepancies. The user must manually extract and apply the exact red, green, and blue numerical values.
Before you start

Ensure the Developer tab is enabled in your Excel ribbon so you can access the Visual Basic for Applications (VBA) editor, and verify that your workbook is saved in a macro-enabled format (.xlsm).

Solution 1Recommended

Extract and Apply RGB Values Using a VBA Macro

Run a VBA macro on a selected cell to identify its exact Red, Green, and Blue values, then use another macro to apply those exact values to any target cell.

Excel theme colors often update with newer Office releases. By running a simple VBA script on an original Excel 2019 document, you can extract the exact RGB color code of a cell's fill color. You can then use these values to identically match colors in newer versions without relying on standard palettes.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor. Click on Insert from the top menu and select Module to create a new blank script window.

2
Create the RGB Extraction Macro

Type the following code to retrieve the color: Sub FindRGB() MsgBox (ActiveCell.Interior.Color Mod 256) & ", " & ((ActiveCell.Interior.Color \\ 256) Mod 256) & ", " & (ActiveCell.Interior.Color \\ 65536) End Sub.

3
Run the Extraction Macro

Return to your worksheet, select the cell containing the Excel 2019 theme color you want to identify, and press Alt + F8. Select the FindRGB macro and click Run. Note the three numbers displayed in the pop-up box.

4
Apply the Extracted Color

Back in the VBA editor, add the following macro to apply the color: Sub ColorCell() ActiveCell.Interior.Color = RGB(red, green, blue) End Sub. Replace the words 'red, green, blue' with the actual numbers you extracted. Select your target cell and run the ColorCell macro.

Extract and Apply RGB Values Using a VBA Macro
Save as Custom Color: Once you apply the exact RGB color to a cell, you can easily reuse it manually by going to Home > Fill Color > More Colors and adding it to your Custom Colors palette.
Advanced VBA Support

Extract and Apply Theme Colors Easily in WPS Office

WPS Spreadsheet offers comprehensive compatibility with Microsoft Excel VBA macros. You can run the exact same VBA codes to find, extract, and apply RGB values seamlessly without worrying about version discrepancies.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing the theme colors you need to extract.
  2. 2. Access the Macro Editor: Navigate to the Tools tab on the top ribbon, click on Macro, and select Visual Basic Editor to open the developer environment.
  3. 3. Run your VBA Code: Insert a new module, paste your RGB extraction or application code, and run it exactly as you would in Microsoft Excel.
Fully compatible with Microsoft Excel VBA macro codesSeamlessly open and edit .xlsm macro-enabled filesFree and lightweight alternative for complex data tasksFamiliar ribbon interface ensures zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

How do I find the RGB value without using VBA?

You can find a cell's RGB value manually by selecting the cell, navigating to the Home tab, clicking the Fill Color dropdown, and selecting More Colors. In the Custom tab of the dialog box, you will see the exact Red, Green, and Blue numerical values.

Why do my Excel theme colors look different when sent to another user?

Different versions of Microsoft Office use different default color palettes (themes). If a workbook isn't set to a specific custom theme or if the colors aren't hardcoded using RGB values, the colors will default to the recipient's standard version palette, altering their appearance.

Can I save custom RGB colors for future workbooks?

Yes. Once you find the specific RGB color, you can apply it and then go to Page Layout > Colors > Customize Colors. Here you can set the exact RGB values as part of a Custom Theme and save it to ensure consistent colors across all new documents.