ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to highlight rows that meet specific conditions (https://www.excelbanter.com/excel-programming/394242-macro-highlight-rows-meet-specific-conditions.html)

amanda

macro to highlight rows that meet specific conditions
 
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!


[email protected]

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.



All times are GMT +1. The time now is 06:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com