Compare dates

gopi09_m

New Member
Joined
May 18, 2008
Messages
6
Hi

User wants to look for a value in the files that are generated/modified in the last n days.
To be precsie i asked the user to provide me with the date so that i can look for the files that are geenrated after that date and copy them to a particular folder and then search for the value he wanted.

i know how to access the last modified date of a file
I want to know how do i compare the date user gives (MM/DD/YYYY) with the file last modified date ?
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
If the User's date is a text string, then try something like this...
Code:
If FileDateTime(strTheFile) >= DateValue(strUserDate) Then
 
Upvote 0
the above line of code gives me an error "file not found"

I modified it like below and it worked,
If DateValue(strTheFile) >= DateValue(strUserDate) Then
 
Upvote 0
strTheFile was intended to be the full path and File name of the file you wanted to test its' modification date.

But if you've got it working, then that's what's important.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,176
Members
452,893
Latest member
denay

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