How to highlight all named ranges in Excel?
For some purpose, in Excel, we may always create some range names for a range of cells. Sometimes, we want to know where the named ranges are in the whole workbook and highlight them. The simplest way for us is to click the range names from the Name Box to select the range and fill color to it. But, if there are lots of named ranges in the workbook, this method will be time-consuming. How could we highlight all of the named ranges in Excel at once?
Here is a code to highlight all the named ranges in a workbook, you can do as this:
1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Highlight all named ranges in Excel
Sub HighlightRange() 'Update 20140317 Dim xName As Name Dim Rng As Range On Error Resume Next For Each xName In Application.ActiveWorkbook.Names Set Rng = xName.RefersToRange Rng.Interior.ColorIndex = 6 Next End Sub
3. Then press F5 key to execute this code, and all the named ranges have been highlighted with yellow color in the whole workbook.
1. If you want to fill the named ranges with other colors, you just need to change the ColorIndex = 6 as you like.
2. After applying this code, all the original color in the named ranges are canceled and covered by this new color.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!