If date in cell is older than todays date by 1 month Then Font RED

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,649
Office Version
  1. 2007
Platform
  1. Windows
Hi,
On my worksheet in column H i have dates of when i quoted for a job.
My goal is to check each date with todays date & if more than 1 moth old have that rows Font vbRed.

So my setup is like this.
Headers in Row 1
Dates are all in column H
Values start Row 2 & down the page.
Cells in use are column A to L
Worksheet is called QUOTES

So when the worksheeet QUOTES is open the code will run.
The code will check the date in column H with todays date.
Any date that is older than 1 month will have that rows cells Font changed to vbRed
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
No because it hides rows or deletes them.
I will just leave it & do it manualy thanks
OK, that's fine but as I said before there is absolutely nothing in the code I posted that hides anything. If anything, it may unhide something that was previously hidden.
There is also nothing in the code that deletes anything.

I suggest that you step through the code with F8 and look at the sheet after each press of F8 and it may indicate to you what other code is hiding/deleting something.
 
Upvote 0
To be honest i dont understand all this.

VBA Code:
      .AutoFilter Field:=8, Criteria1:="<" & CLng(DateAdd("m", -1, Date)), Operator:=xlAnd, Criteria2:="<>"
      If .Columns(1).SpecialCells(xlVisible).Count > 1 Then .Offset(1).Resize(.Rows.Count - 1).Font.Color = vbRed
Autofilter, SpecialCells visible, Offset ?

Cant the code just look at the date & if 1 month old change that row to vbRed.

This is basic below & no mention of the above & does the job, only downside it would need to be used for each row.

Code:
If Sheets("QUOTES").Range("H2").Value < DateAdd("m", -1, Date) Then
Range("A2:L2").Font.Color = vbRed
End If

Is the date older than 1 month Yes then that row vbRed.
Next Row
 
Upvote 0

Forum statistics

Threads
1,222,636
Messages
6,167,221
Members
452,104
Latest member
jadethejade

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top