PDA

View Full Version : Solved: Painting cells meeting conditions VBA



VISHAL120
01-25-2012, 07:11 AM
I want to paint the cells for which conditions is met that is the end date and delivery date equal to that to the calendar date.

I know it’s easier with conditional formatting as I have done it in the example attached to show this.

But my problem is on my data I have already used the 3 conditions formatting and the only option now is to do it with VBA.

Can someone just guide of how can I do this with VBA.

Please have a look at my attachement.

Many thanks for the help.

:banghead:

mdmackillop
01-25-2012, 03:51 PM
Is this what you are after?
Sub Formats()
Dim r As Range
Dim cel As Range
Set r = Range("E7:V29")
For Each cel In r
If Cells(cel.Row, 2) = Cells(5, cel.Column) Then cel.Interior.ColorIndex = 3
If Cells(cel.Row, 3) = Cells(5, cel.Column) Then cel.Interior.ColorIndex = 4
Next
End Sub

VISHAL120
01-25-2012, 10:03 PM
Hi,

thanks a lot this i wanted to do.

solved.
:beerchug: