Skip to content

Get Color Code

Location on ribbon: Tab DVD Addin → Group Graphics → Menu Shape Menu

Command ID: btnGetCellColorCode

What it does

The command reads the background colour (Interior.Color) of every cell in a range and writes the numeric colour code back into that cell. The code is Excel's packed integer, R + G×256 + B×65536 — exactly the value VBA and conditional-formatting rules work with.

Use it when you need to standardise a project colour scheme: capture the approved colour for each work package (substructure, rebar, finishes…) and reapply it on other sheets, or to check whether two quantity sheets really use the same palette.

How to use

  1. Open the sheet that holds the coloured range.
  2. Go to tab DVD Addin → group GraphicsShape MenuGet Color Code.
  3. A range picker appears — "Select coloured range to read RGB".
  4. Drag over the coloured cells and press OK.
  5. The command writes the colour code into each cell in that range and reports how many cells were processed.

Example

A programme legend has phase colours in column B. You copy column B into column C and run the command on C2:C4.

Work packageSample cell (fill)After running on the copy
Substructure(yellow fill)65535
Superstructure(green fill)5287936
Finishes(orange fill)49407

You can now paste those three codes into the project's colour standard so every sheet uses the same values.

Notes

  • The code overwrites the cell it read, destroying the previous content — run it on a copy of the coloured range, never on the master table.
  • The change cannot be undone with Ctrl+Z; recover by closing without saving or by pasting the original data back.
  • A cell with No Fill returns the default white code 16777215 rather than a blank.
  • Colours produced by conditional formatting are not read — only the static cell fill is returned.
  • Hold ESC to stop early; the cells already written keep their values.
  • Color Rectangles — build coloured rectangles from these very codes.
  • Color Shapes — apply colour codes to shapes on the sheet.
  • Sync Format — replicate formatting, fill colour included, onto another range.
  • Get Position — sibling command that reads object properties into cells.

Released under DVDAddin License.