Private Sub Worksheet_SelectionChange(ByVal Target As Range) If (Left(ActiveCell.Text, 1) = "#" And Len(ActiveCell.Text) = 7) Then ActiveCell.Interior.Color = WorksheetFunction.Hex2Dec(Mid$(ActiveCell.Text, 2)) End If End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If (Left(ActiveCell.Text, 1) = "#" And Len(ActiveCell.Text) = 7) Then ActiveCell.Interior.Color = WorksheetFunction.Hex2Dec(Mid$(ActiveCell.Text, 2)) End If End Sub