Skip to main content

Kutools for Office — 一套工具,五種功能。完成更多工作。

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

Author Kelly Last modified

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

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

使用 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 中的使用位置

 

最佳 Office 生產力工具

🤖 Kutools AI 助手:以智能執行為基礎,革新數據分析 生成程式碼 創建自訂公式 分析數據並生成圖表 調用 Kutools 增強函數
熱門功能查找、選取項目的背景色或標記重複值刪除空行合併列或單元格且不遺失數據四捨五入(免公式)...
高級 LOOKUP多條件 VLookup多值 VLookup多表查找模糊查找...
高級下拉列表快速創建下拉列表 依賴型下拉列表 多選下拉列表...
列管理器添加指定數量的列移動列切換隱藏列的顯示狀態比較區域及列...
精選功能網格聚焦 設計檢視 增強編輯欄 工作簿及工作表管理器 資源庫(快捷文本) 日期提取器 合併資料 加密/解密儲存格 按列表發送電子郵件 超級篩選 特殊篩選(篩選粗體/傾斜/刪除線...)...
15 大工具集12 項文本工具添加文本刪除特定字符…)50+ 儀表 類型甘特圖等)40+ 實用 公式基於生日計算年齡等)19 項插入工具插入QR码根據路徑插入圖片等)12 項轉換工具金額轉大寫匯率轉換等)7 項合併與分割工具高級合併行分割儲存格等)...及更多
使用 Kutools,語言任你選 — 支援英語、西班牙語、德語、法語、中文及超過40 種語言!

運用 Kutools for Excel,全面提升您的 Excel 技能,體驗前所未有的高效。 Kutools for Excel 提供超過300 項進階功能,讓您提升工作效率、節省時間。 點此尋找您最需要的功能...


Office Tab 為 Office 帶來分頁介面,讓您的工作更加輕鬆簡單

  • 在 Word、Excel、PowerPoint 中啟用分頁編輯與閱讀
  • 在同一視窗的新分頁中打開與創建多份文件,而非開啟新視窗。
  • 提升您的生產力50%,每日可幫您減少數百次鼠標點擊!

所有 Kutools 外掛,一次安裝

Kutools for Office 套裝整合了 Excel、Word、Outlook 和 PowerPoint 的外掛,外加 Office Tab Pro,非常適合需要跨 Office 應用程式協同作業的團隊。

Excel Word Outlook Tabs PowerPoint
  • 全合一套裝 — Excel、Word、Outlook及 PowerPoint 外掛 + Office Tab Pro
  • 一鍵安裝,一份授權 — 幾分鐘完成設置(支援 MSI)
  • 協同運作更順暢 — Office 應用間無縫提升生產力
  • 30 天全功能試用 — 無需註冊、無需信用卡
  • 最超值 — 一次購買,節省單獨外掛費用