View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] mvenkatesan45@gmail.com is offline
external usenet poster
 
Posts: 3
Default macro to highlight rows that meet specific conditions

On Jul 27, 5:00 am, amanda wrote:
Hello! Does anyone know how to write a macro that would highlight an
entire row if the cell value of A1 for example is 3 integers or
greater than the value in D1?

And, more specifically if I can also delete an entire row if the cell
value in a specified column is 1 or less AND the cell value in column
D is zero? Both of those conditione need to be true.

ThankS!


Hi
Try this code

N = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row
For rwIndex1 = 1 To N
If Round(Cells(rwIndex1, 1).Value, 2) < Round(Cells(rwIndex1,
9).Value, 4) Then
Cells(rwIndex1, 4).Interior.ColorIndex =
3
Next rwIndex1

its 2 column not match it will highlight red color on 4th column

Regards
Venky.