Sub Color_red()
'
' Color_red Macro
' Set cell color to red
'
'
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub
"Wazooli" wrote:
So then there is no way to assign a color to a cell using VBA?
Wazooli
"Bob Phillips" wrote:
No, because UDFS return a value, they do not change worksheet attributes.
--
HTH
Bob Phillips
"Wazooli" wrote in message
...
And, P.S. - I don't want to do this via conditional formatting. I would
like
to learn how to do it with VBA.
Wazolli
"Wazooli" wrote:
I have been using the following code, as posted in this usergroup
recently:
Public Function GetCellColor(MyCell As Range) As Variant
GetCellColor = MyCell.Interior.ColorIndex
End Function
This works great, and allows me to use the cell color as a downstream
condition. Is there a similarly succint bit of code that will allow me
to
assign a color to a cell via a UDF?
Thanks,
Wazooli
|