Excel - A macro to get the equivalent numerical codes for colors

September 2017


This macro allows you to get a color code, you can modify it to your convenience:

Sub distri_color()   
  Dim Lign As Integer  
  For Lign = 1 To 12   
    Worksheets(1).Range("C" & Lign).Value = Worksheets(1).Range("B" & Lign).Interior.Color   
  Next Lign  
End Sub
  • 'Replace 12 by the number of lines you want to process.
  • 'Replace "C" by the column you want to use for the result (color code).
  • 'Replace "B" by the column that contains the color to be filtered.

Related

Published by jak58. Latest update on November 22, 2012 at 04:32 AM by deri58.
This document, titled "Excel - A macro to get the equivalent numerical codes for colors," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).