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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -