Solved

Date Range

Posted on 2002-07-15
5
170 Views
Last Modified: 2010-05-02
Hi!

how can I take a date and compare it to a number of days?

for exemple


signupDate = "27/06/2002"
today = date()
if((date - signupDate) > 30) then

?? Thanks
0
Comment
Question by:nfuids
  • 2
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
hes earned 50 total points
ID: 7155492
Use This

Dim FileDiff
FileDiff = DateDiff("d",signupDate,today)
If FileDiff > 30 then.....
0
 
LVL 11

Expert Comment

by:joekendall
ID: 7155499
Dim dSignup As Date
Dim dToday As Date

dSignup = "27/06/2002"
dToday = Date()

If dToday-dSignup > 30 Then
    'Do whatever you want to do here
End If

Thanks!

Joe

0
 

Author Comment

by:nfuids
ID: 7155500
great, what type should I declare FileDiff as ?
0
 
LVL 20

Expert Comment

by:hes
ID: 7155507
DateDiff Returns a Variant (Long)
0
 

Author Comment

by:nfuids
ID: 7155514
Thanks for a quick answer
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question