Select one file for each day in directory based on date & time modified

Reinhardt9

New Member
Joined
Feb 23, 2015
Messages
1
Dear all,
Firstly thanks to all the people who post solutions to problems here, it helps me no end and Ive benefited from the collective wisdom in developing my own VBA skills.

Any help with the following would be much appreciated.

I have a directory with several hundred files in, sorting by date modified I have about 5 files for each calendar day all with different time stamps.

What I want to do is copy the earliest file for each day in the directory into a new folder.

eg. A simplified example is if there were four files in the directory from two different days as per the table below the macro would copy files 1 and 3 (the earliest file for each of the two days)

[TABLE="width: 247"]
<tbody>[TR]
[TD]file no.[/TD]
[TD] date modified[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]31/03/2014 5:00[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]31/03/2014 13:00[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]30/03/2014 14:00[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]30/03/2014 15:00[/TD]
[/TR]
</tbody>[/TABLE]


Many thanks in advance for any help!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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