View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Highlight cells greater than zero

Jodie,

You don't need a macro for this, conditional formatting is a better approach
but if it's a macro you want try this

Sub Shade_Cells()
Dim LastRow As Long
LastRow = Cells(Cells.Rows.count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & LastRow)
For Each c In MyRange
If IsNumeric(c.Value) And c.Value 0 Then
c.Interior.ColorIndex = 6
End If
Next
End Sub

--
Mike

When competing hypotheses are equal, adopt the hypothesis that introduces
the fewest assumptions while still sufficiently answering the question.
Occam''s razor (Abbrev)


"Jodie" wrote:

I need to write a macro where all cells within a specified column are
highlighted in yellow if they have a value greater than zero. Can anyone
please help with this?
--
Thank you, Jodie