Link to home
Start Free TrialLog in
Avatar of brasiman
brasiman

asked on

Macro that moves all files to a new created folder with today's date

I am trying to create a macro that moves all files from one folder, creates a new folder titled with today's date and moves those files into the newly created folder. Could I get some help with that? Thanks!
Avatar of Bill Prew
Bill Prew

You have listed several topic areas, but you mention macro in the question title.  Do you want a VBA macro that can be executed inside Excel?  Or something else?

~bp
Avatar of brasiman

ASKER

Hi Bill, sorry for the confusion. I am new to this and didn't even realize I referenced multiple topics. :) You are correct, in excel, I would like to create a button that runs a script to take files in a specific folder on my C drive, create a new folder with today's date in a different folder on my C drive, then paste those files into the newly created folder. I have multiple .xls and .csv files in C:\temp. When i click on this button in Excel, I am hoping to move those files in C:\temp and create a folder with today's date in C:\Complete\.
I just remembered too, I also have other .xls and .csv files in another folder, C:\temp2 that another employee accesses. I did it that way for permissions on my network. So, I am looking to click a button in Excel which will take all the files in C:\temp and C:\temp2, combine them into one newly created folder with today's days in C:\Complete\. I hope i'm making sense. :)
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Bill. When I run it, i get an error. It says Combile error: Sub or Function not identified. It is highlighting the "CreateDir (ToDir)" line.
Did you past in all the code I put up, there were three routines that are needed, including the one you mentioned.

~bp
Yes. I will re-paste it now and try it again.
I must have not copied it all. You're awesome. That worked exactly like i was hoping. Thank you!!!
Awesome, thank you!!
Great, glad you got it working and it was useful.

~bp
Thanks again!