vba - Get Excel cell background color hex value -
i obtain background color of cell in excel sheet using formula or vga. found udf:
public function bcolor(r range) long bcolor = r(1).interior.colorindex end function
it can used in cell: =bcolor(a1)
i'm not familiar vga, returns long value , wonder if possible obtain hex value directly. thank you!
try this
function hexcode(cell range) string hexcode = right("000000" & hex(cell.interior.color), 6) end function
Comments
Post a Comment