{"id":2034,"date":"2021-03-02T10:53:21","date_gmt":"2021-03-02T10:53:21","guid":{"rendered":"https:\/\/www.sorcim.com\/blog\/?p=2034"},"modified":"2024-12-19T22:20:57","modified_gmt":"2024-12-19T22:20:57","slug":"excel-macro-to-rename-multiple-files-in-a-folder-and-subfolders","status":"publish","type":"post","link":"https:\/\/www.sorcim.com\/blog\/excel-macro-to-rename-multiple-files-in-a-folder-and-subfolders","title":{"rendered":"Excel Macro to Rename Multiple Files in a Folder and Subfolders"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Have you ever been in a situation when you&#8217;ve got hundreds of Excel files stored in a folder and you need to rename them? Well, there&#8217;s a quick and automated solution to rename a bunch of files without going through each one of them.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this tutorial, we&#8217;ll walk you through different methods to batch rename your Excel files.<\/span><\/p>\n<p><!--more--><\/p>\n<blockquote><p><strong>Rename multiple files in folders and subfolders. Utilize 10+ renaming rules. Also rename files on the Cloud. Use <a href=\"https:\/\/www.easyfilerenamer.com\/download\/ibx\" target=\"_blank\" rel=\"nofollow noopener\">Easy File Renamer<\/a> today!\u00a0<\/strong><\/p><\/blockquote>\n<p><b>Excel Macros<\/b><\/p>\n<p><span style=\"font-weight: 400;\">A Macro is a rule or pattern that specifies how to map a certain input into a preset sequence of output. The intent behind the creation of macros is to avoid repetitive tasks and make complex operations easier.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Macros are popularly used in different professions. For example, software programmers use them to reuse an existing code. In Excel, macros are very popular among financial analysts who use them to generate financial ratios, build portfolios, investment scenarios, etc. Stock market dealers often use macros to monitor price changing patterns, maintain complex trading patterns, build risk management systems, and forecast earnings\/ losses.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In contrast to functions, macros are always pre-processed before your program compiles.<\/span><\/p>\n<p><b>Rename Multiple Files in a Folder Using Excel Macros<\/b><\/p>\n<p><b>Method 1: Rename Files with Similar Name Patterns<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, we assume that your file names have a similar name pattern. You can use this method if your file names have common text with an incremental number. For example, MyFile1.xlsx, MyFile2.xlsx, MyFile3.xlsx, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Steps:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Open Microsoft Excel and create a new WorkBook.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Type the list of all your file names in the folder you want to rename in Column B.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Type the new names for those files in Column D.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Click the Developer tab on the Ribbon interface and then click the Visual Basic icon. Alternatively, you may press Alt + F11.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Excel will launch the Visual Basic Editor window which is mainly split into two parts:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A narrow left part consists of the Project Explorer panel and the Properties panel. In Project Explorer, you&#8217;ll see your active WorkBook along with sub-sheets (such as Sheet1, Sheet2, etc)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A wider part on the centre-right lets you view, write and edit the code.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Type the following code into the Code window:<\/span><\/p>\n<p><a href=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2040\" src=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image4-300x156.png\" alt=\"\" width=\"300\" height=\"156\" srcset=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image4-300x156.png 300w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image4-768x399.png 768w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image4.png 1009w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Click on the Save icon to save your code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now click the Run icon on the toolbar to execute your macro.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Excel will display a new dialog with the list of available macros. Select your current macro, and click on Run to confirm execution.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Choose the folders that contain the files you want to rename (for example, C:\\Users\\XYZ\\Documents) and click on OK.<\/span><\/p>\n<p><b>Method 2: Rename Files with Different Name Patterns<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Use this method if you need to rename files that have different file name\u00a0 patterns (existing). In other words, these file names are not common in each other. They&#8217;re unique. For example, Taxes.xlsx, Insurance.xlsx, Mortgages.xlsx, etc.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Steps:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Open Excel and create a new WorkBook.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Click on the Insert tab on the Ribbon interface and choose to create a new Table.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Create a table with 2 columns and insert it into the cells binding A and B columns.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In Column A, specify the header name: File Names.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In Column B, specify the header name: New Names.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the subsequent rows (Cell A2, A3, &#8230;), write a list of all files that you want to rename.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In Cell B2, B3, &#8230;, write new names for your files.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Press Alt + F11 to open the Visual Basic Editor window.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Type the following code:<\/span><\/p>\n<p><a href=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2041\" src=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3-300x213.png\" alt=\"\" width=\"300\" height=\"213\" srcset=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3-300x213.png 300w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3-768x546.png 768w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3-1024x728.png 1024w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image3.png 1029w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Click on the Run icon on the toolbar and confirm your action to execute it.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><b>Method 3: Automatically Batch Rename Files Without Macro\/ Coding Knowledge (Recommended)<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Not everyone has coding knowledge. Sometimes, things may go wrong or you may accidentally alter some important files in an attempt to rename them.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The best way to prevent this dilemma is to use specialized software built to batch rename Excel WorkBooks and other files. Easy File Renamer is an industry-leading solution that provides plenty of file renaming patterns and automates the complete procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Easy File Renamer is your best bet if you&#8217;re<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Not willing to take the risk of losing your data due to incorrect coding\/ macros<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Don&#8217;t have the expertise to deal with Excel Macros and advanced Excel tools<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Looking for a 1-Click solution with a user-friendly interface to get the task done without any hassle<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Want to perform advanced renaming (insert text, remove text from filenames, replace characters, etc.)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Save time<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Have files with complex file renaming patterns (such as files with similar and different name patterns in the same folder)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Want to opt-out certain files from renaming<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Steps:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Download Easy File Renamer and install it on your computer.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Exit Microsoft Excel. If your WorkBooks are open, they cannot be renamed while in use.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Open EFR and click on the System Renamer tab.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To add individual files, select the Files option. To add folders, select the Folders option.<\/span><\/p>\n<p><a href=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2039\" src=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2-300x62.png\" alt=\"\" width=\"300\" height=\"62\" srcset=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2-300x62.png 300w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2-768x160.png 768w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2-1024x213.png 1024w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image2.png 1251w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Click on Add Files or Add Folders (depending on what you&#8217;ve selected earlier), and then select your files\/ folders.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">EFR will list out all the selected items in the interface along with their full paths.<\/span><\/p>\n<p><a href=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2038\" src=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image1-242x300.png\" alt=\"\" width=\"242\" height=\"300\" srcset=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image1-242x300.png 242w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png 372w\" sizes=\"auto, (max-width: 242px) 100vw, 242px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">On the left-hand side, click on Select Rule and choose your desired renaming criteria. Add that rule by clicking the Add Rule option.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Repeat the same procedure to add multiple rules, if required.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Click on the Rename button on the bottom right corner.<\/span><\/p>\n<p><a href=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2037\" src=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image5-300x100.png\" alt=\"\" width=\"300\" height=\"100\" srcset=\"https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image5-300x100.png 300w, https:\/\/www.sorcim.com\/blog\/wp-content\/uploads\/2021\/03\/image5.png 322w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">EFR will now rename the files within seconds.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever been in a situation when you&#8217;ve got hundreds of Excel files stored in a folder and you need to rename them? Well, there&#8217;s a quick and automated solution to rename a bunch of files without going through each one of them. In this tutorial, we&#8217;ll walk you through different methods to batch [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[1056,1065,1067,1066,1057,1064,1068],"class_list":["post-2034","post","type-post","status-publish","format-standard","hentry","category-data-management","tag-excel","tag-excel-macro","tag-excel-macro-rename-files","tag-macro","tag-microsoft-excel","tag-msc-excel","tag-rename-files-with-excel-macro"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/posts\/2034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/comments?post=2034"}],"version-history":[{"count":4,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/posts\/2034\/revisions"}],"predecessor-version":[{"id":2636,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/posts\/2034\/revisions\/2636"}],"wp:attachment":[{"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/media?parent=2034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/categories?post=2034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sorcim.com\/blog\/wp-json\/wp\/v2\/tags?post=2034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}