View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default Formatting from a Function

On Mon, 2 Jan 2006 14:34:04 +0100, "VALid" wrote:


Hi,

I wrote that very simple function.... which does NOT work.
Any idea why??? Thanks.

Public Function SetCellColor(ByVal AnIndex As Long)
'Application.Volatile (True)
With Selection.Interior
.ColorIndex = AnIndex
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
SetCellColor = AnIndex
End Function



A function can only return a value.

You need to formulate a Sub in order to affect a cell's appearance.


--ron