Excel VBA File Moving/Renaming

Kaladin

New Member
Joined
Jul 16, 2014
Messages
48
Hey guys. I've done some snooping around to find the solution to my particular problem, but don't know enough about using VBA outside of Excel to figure it out with what I've found. Here's what I want to happen:

I want all files with the extension .pdf, .doc, .zip, and .7z to be copied from a large group of subfolders and pasted into one folder. Most of these files will begin with an 8-digit ID that represents a name. I would like all files that begin with this 8-digit ID to have that ID replaced with the name that corresponds to it found within the spreadsheet.

In the spreadsheet, let's say the 8-digit IDs are A:A and the names are B:B. The folder that contains all subfolders will be C:/Sourcefolder and the destination folder will be C:/Destinationfolder.

How would I do this?

Here are the things I've found so far that are very close.

excel - Cycle through sub-folders and files in a user-specified root directory - Stack Overflow
excel vba - copying files from multiple subfolders using vba - Stack Overflow
Move files to another folder by VBA
Copy and Move files and folders

Thank you guys in advance for your help. I had a hard time following some of the code found at these sources, but I tend to understand the stuff I find here.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,455
Messages
6,124,938
Members
449,197
Latest member
k_bs

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