I have a function which gives a value depending on the colour of a specified cell.
Function CheckColor1(range)
If range.Interior.Color = RGB(189, 215, 238) Then
CheckColor1 = "R"
ElseIf range.Interior.Color = RGB(255, 230, 153) Then
CheckColor1 = "C"
End If
End Function
In L1 I have =CheckColor1(a1) and I fill down for all rows. It gives me the corresponding "R" and "C" for each row.
I then, in M1, use an =L1 next to it, fill down again, copy > paste values. I tried copy > paste values directly on the L Column, but it does not work.
I recorded this. Which gave me:
range("L1").Select
ActiveCell.FormulaR1C1 = "=CheckColor1(RC[-11])"
range("L1").Select
Selection.AutoFill Destination:=range("L1:L102")
range("L1:L102").Select
range("M1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]"
range("M1").Select
Selection.AutoFill Destination:=range("M1:M102")
range("M1:M102").Select
However, when I run the Macro, I get the first value correctly in L1, but then all values underneath that I get a #VALUE error. Which says A Value used in the formula is of the wrong data type.
The Columns are "General" format.