Sub GetColourHex() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim str0 As String, str As String Dim cel As Range For Each cel In Selection str0 = Right("000000" & Hex(cel.Interior.Color), 6) str = Right(str0, 2) & Mid(str0, 3, 2) & Left(str0, 2) cel = "#" & str & "" Next cel done: Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter