View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KAH KAH is offline
external usenet poster
 
Posts: 6
Default function to colour cells

I want to write a function to colour a given cell based on the value of a
variables. Below if what I have so far. But I am not sure how to define the
function or how to use cells in functions. Any assistance is appreciated.

If wsResults.Cells(x, y).Value < (z) Then
Cells(x,y).Select
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
ElseIf wsResults.Cells(x,y).Value (z) Then
Cells(x,y).Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
End If