Conditional Formatting

Solved/Closed
tareqnaser95 Posts 1 Registration date Tuesday September 9, 2014 Status Member Last seen September 9, 2014 - Sep 9, 2014 at 12:36 PM
Osama_bb11 Posts 21 Registration date Sunday May 25, 2014 Status Member Last seen September 25, 2014 - Sep 10, 2014 at 02:25 PM
Suppose I have date in Column A (from A1 to A100) and in Column B (from B1 to B100), Both data are numerical. If the data in Column A is greater than or equal to the data in Column B then it will be red i.e. A1 cell will check the condition with B1 cell, A2 cell will check the condition with B2 cell and so on.
Please solve the problem

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Sep 10, 2014 at 02:20 AM
try this macro

Sub test()
Dim r As Range, c As Range
Worksheets("sheet1").Activate
Set r = Range(Range("A1"), Range("A1").End(xlDown))
For Each c In r
If c >= c.Offset(0, 1) Then c.Interior.ColorIndex = 3
Next c
End Sub
0
Osama_bb11 Posts 21 Registration date Sunday May 25, 2014 Status Member Last seen September 25, 2014
Sep 10, 2014 at 02:25 PM
Hi

also you can add conditional format to column A

1-select the cellA1
2-conditional formatting --> new rule
3-format only cells that contains ..
4- Cell vale ---less than---$b$1 ( remove $ ) $B1
5-format ( the way you like )


use format painter to copy the A1 format to al1 A column
0