Some Help Please anyone

  • Thread starter Thread starter WiReLaD
  • Start date Start date
W

WiReLaD

I was wondering if you could help me with a VBA problem?

I have a range of cells with a date format. I want to check each cell and
check its date against today's date.
So. I have the first cell selected. I then run a do loop until I reach a
"nil" cell.

On each cell select, I want it to check (a) the cell value (b) is it grater
than Now()

If it is > = to Now() then I want the cell to change VBred.

Thanks
WiReLad
 
Something like:

Sub cellcheck()
If ActiveCell.Value >= Date Then ActiveCell.Interior.ColorIndex = 3 ' (you
can do more formatting here if you want)
End Sub

Joe90
 
try this. Modify to suit.

Sub colorem()
x = Cells(65536, 1).End(xlUp).Row
For Each c In Range(Cells(1, 1), Cells(x, 1))
If c > Date Then c.Font.ColorIndex = 3
Next c
End Sub
 
I was wondering if you could help me with a VBA problem?

I have a range of cells with a date format. I want to check each cell and
check its date against today's date.
So. I have the first cell selected. I then run a do loop until I reach a
"nil" cell.

On each cell select, I want it to check (a) the cell value (b) is it grater
than Now()

If it is > = to Now() then I want the cell to change VBred.

Thanks
WiReLad

Here's another approach that saves looping through all the cells, so should be
quicker *IF* you are not otherwise using conditional formatting and *IF* you
want the color to change if you change the contents:


With Range("A1:A100")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual _
, Formula1:="=NOW()"
.FormatConditions(1).Interior.Color = vbRed
End With


--ron
 
Back
Top