Forum Discussion
Matching file names in Excel column to file names in folder
You should place this code on a Standard Module like Module1 and to do so follow these steps...
- Open your file and then press Alt+F11 to open VB Editor.
- On VB Editor Ribbon -->go to Insert Tab --> and choose Module. This will insert a new Module called Module1 and open a code window.
- Paste the code into the opened code window, close the VB Editor.
- Save your file as Macro-Enabled Workbook.
- On the sheet with data, insert a Shape or a Button from Form Controls, right click to it and choose Assign Macro and then choose the macro SearchFiles from the available macro list and click OK to finish.
- Now you may click this shape or button to run the code.
Please find the attached in which I have placed the code on Module1 and inserted a button called "Search Files" on the Sheet. You may click this button to run the code.
No, you cannot undo the steps performed by the macro. Btw what is there which you want to undo after the code execution?
In the attached, I have also tweaked the path of the source folder. Now the code assumes that you have a folder called "Document folder" with all the files on your Desktop.
The tweaked line is as below...
rootFolder = Environ("UserProfile") & "\Desktop\Document Folder"
Subodh_Tiwari_sktneer Thank you for your detailed response! I will give that a try and circle back if I run into any errors.