How to find where a certain named range is used in Excel?
After creating a named range, you may use this named range in many cells and formulas. But how to find out these cells and formulas in current workbook? This article introduces three tricky ways to solve it easily.
We can easily apply Excel’s Find and Replace feature to find out all cells applying the certain named range. Please do as follows:
1. Press the Ctrl + F keys simultaneously to open the Find and Replace dialog box.
Note: You can also open this Find and Replace dialog box with clicking the Home > Find & Select > Find.
2. In the opening Find and Replace dialog box, please do as following screenshot shown:
(1) Type the name of certain named range into the Find what box;
(2) Select Workbook from the Within drop down list;
(3) Click the Find All button.
Note: If the Within drop down list is invisible, please click the Options button to expand the searching options.
Now you will see all cells containing the name of specified named range are listing at the bottom of Find and Replace dialog box. See screenshot:
Note: The Find and Replace method not only finds out all cells using this certain named range, but also finds out all cells covering with this named range.
This method will introduce a VBA macro to find out all cells which use the certain named range in Excel. Please do as follows:
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. Click the Insert > Module, and copy and paste following code into the opening Module window.
VBA: Find where a certain named range is used
3. Click the Run button or press F5 Key to run this VBA.
Sub Find_namedrange_place() Dim xRg As Range Dim xCell As Range Dim xSht As Worksheet Dim xFoundAt As String Dim xAddress As String Dim xShName As String Dim xSearchName As String On Error Resume Next xShName = Application.InputBox("Please type a sheet name you will find cells in:", "Kutools for Excel", Application.ActiveSheet.Name) Set xSht = Application.Worksheets(xShName) Set xRg = xSht.Cells.SpecialCells(xlCellTypeFormulas) On Error GoTo 0 If Not xRg Is Nothing Then xSearchName = Application.InputBox("Please type the name of named range:", "Kutools for Excel") Set xCell = xRg.Find(What:=xSearchName, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not xCell Is Nothing Then xAddress = xCell.Address If IsPresent(xCell.Formula, xSearchName) Then xFoundAt = xCell.Address End If Do Set xCell = xRg.FindNext(xCell) If Not xCell Is Nothing Then If xCell.Address = xAddress Then Exit Do If IsPresent(xCell.Formula, xSearchName) Then If xFoundAt = "" Then xFoundAt = xCell.Address Else xFoundAt = xFoundAt & ", " & xCell.Address End If End If Else Exit Do End If Loop End If If xFoundAt = "" Then MsgBox "The Named Range was not found", , "Kutools for Excel" Else MsgBox "The Named Range has been found these locations: " & xFoundAt, , "Kutools for Excel" End If On Error Resume Next xSht.Range(xFoundAt).Select End If End Sub Private Function IsPresent(sFormula As String, sName As String) As Boolean Dim xPos1 As Long Dim xPos2 As Long Dim xLen As Long Dim I As Long xLen = Len(sFormula) xPos2 = 1 Do xPos1 = InStr(xPos2, sFormula, sName) - 1 If xPos1 < 1 Then Exit Do IsPresent = IsVaildChar(sFormula, xPos1) xPos2 = xPos1 + Len(sName) + 1 If IsPresent Then If xPos2 <= xLen Then IsPresent = IsVaildChar(sFormula, xPos2) End If End If Loop End Function Private Function IsVaildChar(sFormula As String, Pos As Long) As Boolean Dim I As Long IsVaildChar = True For I = 65 To 90 If UCase(Mid(sFormula, Pos, 1)) = Chr(I) Then IsVaildChar = False Exit For End If Next I If IsVaildChar = True Then If UCase(Mid(sFormula, Pos, 1)) = Chr(34) Then IsVaildChar = False End If End If If IsVaildChar = True Then If UCase(Mid(sFormula, Pos, 1)) = Chr(95) Then IsVaildChar = False End If End If End Function
4. Now in the first opening Kutools for Excel dialog box please type the worksheet name into it and click the OK button; and then in the second opening dialog box please type the name of certain named range into it, and click the OK button. See screenshots:
5. Now the third Kutools for Excel dialog box comes out and lists cells using the certain named range as below screenshot shown.
After clicking the OK button to close this dialog box, these found cells are selected in the specified worksheet at once.
Note: This VBA can only look for cells using the certain named range in one worksheet at a time.
In you have Kutools for Excel installed, its Replace Range Names utility can help you find and list all cells and formulas which use the certain named range in Excel.
1. Click the Kutools > More > Replace Range Names to open the Replace Range Names dialog box.
2. In the opening Replace Range Names dialog box, go to Name tab, and click the Base Name drop down list and select the certain named range from it as below screenshot shown:
Now all cells and corresponding formulas which use the certain named range are listing in the dialog box at once.
3. Close the Replace Range Names dialog box.
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!