View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Highlight cells greater than zero

I would prefer to use conditional formatting instead of code. Look up
Conditional Formatting in the help section it should help you.

If you must use code you can use this:

Sub HighlightCells()

Dim rng As Range

For Each rng In Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
If rng.Value 0 Then
rng.Interior.Color = vbYellow
End If
Next rng

End Sub

Hope this helps! If so, let me know, click "YES" below.
--
Cheers,
Ryan


"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