Skip to main content

如何在 Excel 中找到某個特定名稱範圍的使用位置?

Author: Kelly Last Modified: 2025-05-12

在建立一個名稱範圍後,您可能會在許多單元格和公式中使用這個名稱範圍。但是,如何在當前工作簿中找出這些單元格和公式呢?本文介紹了三種巧妙的方法來輕鬆解決這個問題。

使用「尋找和替換」功能查找某個特定名稱範圍的使用位置

使用 VBA 查找某個特定名稱範圍的使用位置

使用 Kutools for Excel 查找某個特定名稱範圍的使用位置


arrow blue right bubble 使用「尋找和替換」功能查找某個特定名稱範圍的使用位置

我們可以輕鬆應用 Excel 的「尋找和替換」功能來找出所有應用該特定名稱範圍的單元格。請按照以下步驟操作:

1. 同時按下 Ctrl + F 鍵以打開「尋找和替換」對話框。

注意:您也可以通過點擊「Home」>「Find & Select」>「Find」來打開此「尋找和替換」對話框。

2. 在打開的「尋找和替換」對話框中,請按照以下截圖所示進行操作:

set options in the Find and Replace dialog box

(1) 在「尋找內容」框中輸入特定名稱範圍的名稱;

(2) 從「Within」下拉列表中選擇「Workbook」;

(3) 點擊「尋找全部」按鈕。

注意:如果「Within」下拉列表不可見,請點擊「選項 」按鈕以展開搜索選項。

現在,您將看到所有包含指定名稱範圍名稱的單元格都列在「尋找和替換」對話框的底部。請參閱截圖:

all cells containing the name of specified named range are listing

注意:「尋找和替換」方法不僅能找出所有使用該特定名稱範圍的單元格,還能找出所有覆蓋該名稱範圍的單元格。



arrow blue right bubble 使用 VBA 查找某個特定名稱範圍的使用位置

此方法將介紹一個 VBA 宏,用於找出所有使用該特定名稱範圍的單元格。請按照以下步驟操作:

1. 同時按下 Alt + F11 鍵以打開 Microsoft Visual Basic for Applications 窗口。

2. 點擊「 Insert」>「Module」,然後複製並將以下代碼粘貼到打開的「Module」窗口中。

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
3. 點擊 Run 按鈕或按下 F5 鍵來運行此 VBA。

4. 現在,在第一個打開的 Kutools for Excel 對話框中,請輸入工作表名稱並點擊「OK」按鈕;然後在第二個打開的對話框中,請輸入特定名稱範圍的名稱,並點擊「OK」按鈕。請參閱截圖:

type the worksheet name
type the named range

5. 現在,第三個 Kutools for Excel 對話框出現並列出使用該特定名稱範圍的單元格,如下截圖所示。

a dialog box comes out and lists cells using the certain named range

點擊「OK」按鈕關閉此對話框後,這些找到的單元格將立即在指定的工作表中被選中。

注意:此 VBA 每次只能查找一個工作表中使用該特定名稱範圍的單元格。


arrow blue right bubble使用 Kutools for Excel 查找某個特定名稱範圍的使用位置

如果您已安裝 Kutools for Excel,其「Replace Range Names」工具可以幫助您查找並列出所有使用該特定名稱範圍的單元格和公式。

Kutools for Excel - 包含超過 300 種 Excel 必備工具。永久免費享受 AI 功能!立即下載!

1. 點擊「Kutools」>「More」>「Replace Range Names」 以打開「Replace Range Names」對話框。

click Replace Range Names of kutools

2. 在打開的「Replace Range Names」對話框中,轉到「Name」標籤,點擊「Base Name」 下拉列表並從中選擇特定名稱範圍,如下截圖所示:

select the certain named range from the eplace Range Names dialog box

現在,所有使用該特定名稱範圍的單元格及其相應的公式都會立即列在對話框中。

3. 關閉「Replace Range Names」對話框。

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取


演示:查找某個特定名稱範圍在 Excel 中的使用位置

 

最佳辦公效率工具

🤖 Kutools AI 助手:基於智能執行方式革新數據分析:智能執行   |  生成代碼  |  創建自訂公式  |  分析數據並生成圖表  |  調用 Kutools 函數
熱門功能查找、標記重複值或識別重複項   |  刪除空行   |  合併列或單元格而不丟失數據   |   四捨五入無需公式 ...
高級 LOOKUP多條件 VLookup    多值 VLookup  |   多表查找   |   模糊查找 ....
高級下拉列表快速創建下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
列管理器添加特定數量的列  |  移動列  |  切換隱藏列的可見狀態  |  比較區域和列 ...
特色功能網格聚焦   |  設計檢視   |   增強編輯欄    工作簿與工作表管理器   |  資源庫(自動文本)   |  日期提取器   |  合併資料   |  加密/解密儲存格    按列表發送電子郵件   |  超級篩選   |   特殊篩選(篩選粗體/斜體/刪除線...) ...
頂級 15 種工具集12 個文本工具添加文本刪除特定字符、...)   |   50+ 圖表 類型甘特圖、...)   |   40+ 實用 公式基於生日計算年齡、...)   |   19 個插入工具插入QR碼根據路徑插入圖片、...)   |   12 個轉換工具金額轉大寫匯率轉換、...)   |   7 個合併與分割工具高級合併行分割儲存格、...)   |   ... 還有更多

使用 Kutools for Excel 提升您的 Excel 技巧,體驗前所未有的高效。 Kutools for Excel 提供超過 300 種高級功能來提高生產力並節省時間。  點擊這裡獲取您最需要的功能...


Office Tab 將標籤式界面帶到 Office,讓您的工作更加輕鬆

  • 在 Word、Excel、PowerPoint、Publisher、Access、Visio 和 Project 中啟用標籤式編輯和閱讀。
  • 在同一窗口的新標籤中打開和創建多個文檔,而不是在新窗口中。
  • 將您的生產力提高 50%,每天為您減少數百次鼠標點擊!