View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
haileybury haileybury is offline
external usenet poster
 
Posts: 7
Default Setting cell colors using RGB( ) function

I have a range of cells with different RGB values e.g.
Column 1
RGB(0,0,0)
RGB(0,255,0)

I am reading these values and in my macro and setting the color of a range
of cells
using the following statement.

rangec.Interior.Color = Worksheets("output").Cells(mrgb,
13).Value

I get an error message stating that VB is unable to set the color property
however when I hard code the value as below, the code works fine.

rangec.Interior.Color = RGB(0,255,0)

I did not want to hard code it because of the obvious reason ( for users to
change/add colours in the future)

I tries capturing the cell value in a variable ( tried string, variant) and
nothing worked. Also I tried vbRed; vbBlue etc instead of the RGB( ) function
and still the same behaviour.

Wondering if anyone has any tips?