highlighting rows

  • Thread starter Thread starter amanda
  • Start date Start date
A

amanda

Hello,

I woudl like to write a macro that highlights rows if cell values in
columns m,n, and o ALL = zero.

Thanks,
Amanda
 
Right click sheet tab, view code paste this in and run it

Sub copyit()
Dim MyRange As Range
lastrow = Cells(Rows.Count, "M").End(xlUp).Row
Set MyRange = Sheets("Sheet1").Range("M1:M" & lastrow)
For Each c In MyRange
If c.Value = "zero" And c.Offset(0, 1).Value = "zero" _
And c.Offset(0, 2).Value = "zero" Then
c.EntireRow.Interior.ColorIndex = 3
End If
Next
End Sub

Mike
 
Hello,

I woudl like to write a macro that highlights rows if cell values in
columns m,n, and o ALL = zero.

Thanks,
Amanda

Hi Amanda,
Why use a macro, when conditional formatting helps in this case?
Cheers,
Tausif
 
Back
Top