vba - How to highlight a cell using the hex color value within the cell? - Stack Overflow

PHOTO EMBED

Wed Aug 14 2024 09:45:11 GMT+0000 (Coordinated Universal Time)

Saved by @baamn #vb #excel

Sub ColorCellsByHexInCells()
  Dim rSelection As Range, rCell As Range

  If TypeName(Selection) = "Range" Then
  Set rSelection = Selection
    For Each rCell In rSelection
      rCell.Interior.Color = WorksheetFunction.Hex2Dec(Mid$(rCell.Text, 2))
    Next
  End If
End Sub
content_copyCOPY

https://stackoverflow.com/questions/10455366/how-to-highlight-a-cell-using-the-hex-color-value-within-the-cell?rq