excel - Changing ActiveCell's Font Colour and Background Colour -


please me. have 2 functions in vba excel.

1 change active cell's font colour , works perfectly. second change active cells background colour, , refuses work.

in stackoverflow there similar query , using method yet won't work. doing wrong? want reference 3 cells numberic values excel see colour going on fly.

change activecell font colour (working)

public function fontcolour(r, g, b) activecell.font.color = rgb(r, g, b) end function 


change activecell colour (not working)

public function cellcolour(r, g, b) activecell.interior.colorindex = rgb(r, g, b) end function 

i think confusing colorindex , color?

colorindex can used values 1-56 , has set of predetermined colours, color allows use colour, specified rgb values.

try , update function to

public function cellcolour(r, g, b)   activecell.interior.color = rgb(r, g, b) end function 

Comments