that allows you to quickly rename all the files in a specified directory.
How to batch rename multiple range names in Excel?
To rename a range name is easy and usually used in our daily Excel work, but to batch rename multiple range names will be troublesome. In this article, I introduce a macro code to quickly batch rename multiple range names in Excel.
Recommended Excel Productivity Tools
Supposing there are several range names in a workbook as below screenshot shown, now I will rename them by adding a prefix.
1. Press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window, and click Insert > Module. See screenshot:
2. Paste below code to the Module script, and press F5 to run the code.
VBA: Rename range names
Sub RenameCells() Dim n As Name For Each n In ThisWorkbook.Names n.Name = "KUTOOLS_" & n.Name Next n End Sub
Then all range names have been renamed by adding the specified prefix. See screenshot:
Note: In the above code n.Name = "KUTOOLS_" & n.Name, you can change KUTOOLS to other string as you need.
Tip.If you want to quickly rename multiple sheets, please try to use the Kutools for Excel’s Rename Multiple Worksheets feacture as shown in the following screenshot. It’s full function without limitation in 60 days, please download and have a free trial now.