MORE THAN 6 MONTHS OLD

bradley7

Board Regular
Joined
Feb 22, 2005
Messages
102
hi guys

in vba, i need code to see if a date is greater than 6 months old
eg today is 10/12/2005
need all older than 10/06/2005

ta guys
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Leonard of Quirm

Board Regular
Joined
May 19, 2005
Messages
180
Brad,
Jus' like that:
Code:
Dim MyDate As Date

Sub asdfasdf()

MyDate = "10/09/2005"
If Date - MyDate < 182 Then '182 days - substitute your own 6 month value
    MsgBox ("The date is within the last six months.")
Else
    MsgBox ("The date is older than six months from today.")
End If

End Sub

Matt
 

Watch MrExcel Video

Forum statistics

Threads
1,118,331
Messages
5,571,578
Members
412,407
Latest member
ElmerCC
Top