macro help - for a file whose name changes based on the date

guruman

Board Regular
Joined
Nov 4, 2004
Messages
64
Hi,

For archiving purposes at work we have to save files with the date at the end of them. So today, the two files that I want to include in the macro are FX020205.xls and CCFX020205.xls

Is there anyway that I can have a macro that will be directed to the folder that they will always be in, look for the beginning of the file name (so FX and CCFX) and then put the date into the 020205 format, put them together and look that up?

Any help would be much appreciated.

Thanks.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Re: macro help - for a file whose name changes based on the

Sure. The filename is just a string -- add to it to your heart's content. Here's an example I use:
Code:
fName = "C:\Documents and Settings\My Documents\Yield data " & Format(Date, "mmddyyyy") & ".xls"

But you could put a cell reference in there, formula text, anything. Hope that helps!
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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