跳到主要內容

如何從Excel中的多個工作表引用同一單元格?

假設您有一個包含多個工作表的工作簿,現在您想將多個工作表中同一單元格中的數據提取到一個主工作表中。 例如,將單元格B8從Sheet1,Sheet2,Sheet3,Sheet4…拉入主表,如下面的屏幕快照所示。 您如何在Excel中快速輕鬆地解決此任務?

使用公式將來自多個工作表的同一單元格引用到一個主表中

使用VBA代碼將多個工作表中的同一單元格引用到一個主表中

將具有多個功能的工作表中的同一單元格引用到一個主表中


使用公式將來自多個工作表的同一單元格引用到一個主表中

如果您的工作表名稱是默認的工作表名稱,例如Sheet1,Sheet2,Sheet3 ...,則可以使用公式在Excel中快速處理此作業。

1。 首先,您應該創建一個助手編號列表,請輸入1、2、3、4 ...序列號,這些序列號指示您需要參考的工作表,請參見屏幕截圖:

2. 然後,將以下公式輸入到要提取數據的單元格中,然後將填充手柄向下拖動到要應用此公式的單元格中,並且已提取多個工作表中所有相同的單元格值,請參見屏幕截圖:

=INDIRECT("'Sheet" & E2 & "'!$B$8")

備註:在以上公式中, E2 是您在步驟1中輸入的幫助者編號,並且 B8 是您要提取的單元格引用。 僅當工作表名稱為Sheet1,Sheet2,Sheet3 ...時,此公式才有效


將多個工作表中的同一單元格引用到一個主表中

Excel的Kutools 支持強大的功能-動態參考工作表 這可以幫助您將多個工作表中的相同單元格值引用到主表中。 請參見下面的演示。    點擊下載Kutools for Excel!


使用VBA代碼將多個工作表中的同一單元格引用到一個主表中

在這種情況下,如果有數十個工作表的工作表名稱是不同的內容而不是Sheet1,sheet2,則下面的VBA代碼可以幫助您將多個工作表中的相同單元格引用一次填充到一個工作表中。

1。 在主工作表中,單擊單元格B8,這是您要從其他工作表中提取的單元格。

2。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications窗口.

3。 點擊 插入 > 模塊,然後將以下代碼粘貼到 模塊窗口.

VBA代碼:從多個工作表中引用同一單元格

Sub AutoFillSheetNames()
'Update by Extendoffice
Dim ActRng As Range
Dim ActWsName As String
Dim ActAddress As String
Dim Ws As Worksheet
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set ActRng = Application.ActiveCell
ActWsName = Application.ActiveSheet.Name
ActAddress = ActRng.Address(False, False)
Application.ScreenUpdating = False
xIndex = 0
For Each Ws In Application.Worksheets
If Ws.Name <> ActWsName Then
ActRng.Offset(xIndex, 0).Value = "='" & Ws.Name & "'!" & ActAddress
xIndex = xIndex + 1
End If
Next
Application.ScreenUpdating = True
End Sub

4。 然後按 F5 鍵來運行此代碼,並且其他工作表中單元格B8的所有值都已拉入“主”工作表中。 看截圖:

注意: 此VBA代碼適用於填充您單擊的單元格。 例如,如果單擊指定工作表中的單元格A1,則其他工作表中單元格A1的所有值都將填充到該工作表中。


將具有多個功能的工作表中的同一單元格引用到一個主表中

如果您不熟悉VBA代碼,請在這里為您介紹一個有用的工具- Excel的Kutools,其 動態參考工作表 實用程序,您可以輕鬆地從Excel中的多個工作表中填充單元格引用。

提示:要應用此 動態參考工作表 功能,首先,您應該下載 Excel的Kutools,然後快速輕鬆地應用該功能。

安裝後 Excel的Kutools,請這樣做:

1。 單擊要從其他工作表中提取母版工作表中的單元格B8。

2. 然後點擊 庫工具 > 更多 > 動態參考工作表,請參見屏幕截圖:

3。 在 填寫工作表參考 對話框中選擇 垂直填充單元格 來自 填寫訂單,然後單擊公式文本框旁邊的小鎖,灰色鎖將變為黃色鎖,這意味著公式和單元格引用已被鎖定,然後您可以單擊任意單元格以從其他工作表中提取單元格B8引用,在在本例中,我將單擊單元格B2。 然後,檢查要從中提取單元格引用的工作表。 看截圖:

備註:如果您未鎖定此小鎖,則單擊的單元格引用將隨所選單元格一起更改。

4。 然後點擊 填充範圍 按鈕,並且其他工作表中的單元格B8的單元格值已在“主”工作表中垂直列出,然後關閉此對話框。 看截圖:

點擊下載Kutools for Excel並立即免費試用!


更多文章:

  • 根據條件將多個工作表中的行複製到新工作表中
  • 假設您有一個包含三個工作表的工作簿,這些工作表的格式與下面的屏幕快照相同。 現在,您想要將這些工作表中的C列包含“已完成”文本的所有行複製到新工作表中。 您如何快速,輕鬆地解決此問題,而又不手動一一複制和粘貼它們?
  • 從多個工作表創建唯一值列表
  • 有什麼快速的方法可以讓我們從工作簿中的所有工作表中創建唯一值列表? 例如,我有四個工作表,其中一些名稱包含A列中的重複名稱,現在,我想將這些表中的所有唯一名稱提取到一個新列表中,如何在Excel中完成此工作?
  • 跨多個工作表的特定值
  • 假設我有多個工作表,其中包含以下數據,現在,我想從這些工作表中獲取特定值“ Excel”的出現次數。 如何在多個工作表中計算特定值?
  • 將相同的圖像插入多個工作表
  • 通常,我們可以使用Excel中的“插入”功能將圖片快速插入到工作表中,但是,是否曾經嘗試過將同一張圖片插入工作簿的所有工作表中? 本文,我將為您介紹一種解決此工作的有用方法。
  • 在Excel中同時在多個工作表上運行相同的宏
  • 通常,我們可以在工作表中運行一個宏,如果有多個工作表需要應用同一宏,則應一張一張地觸發代碼。 是否還有其他快速方法可以在Excel中一次在多個工作表上運行同一宏?

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have create a stock sheet and opening stock list is there and i create 500 sheets for different items so how to put opening stock in all sheets at a time
This comment was minimized by the moderator on the site
Hello,


I have a list of students in column A and the schools they attend in G. I want a worksheet to populate all students who attend X school from the available worksheets. How would I do this? Thanks in advance!
This comment was minimized by the moderator on the site
I have a spreadsheet with all the months. I want some of the cells to carry over from the first month to the proceeding other (i.e., cell B12 in January can be linked to February - December cell B12). How would I do this?
This comment was minimized by the moderator on the site
Hi, thanks it works with a workbook at my job. Thanks Best regards Luzardo
This comment was minimized by the moderator on the site
Dears, Kindly note that I used Reference Same Cell From Multiple Worksheets With VBA Code and it works with me properly, however I need your help in how to me this code retrieve the values in the master sheet horizontal instead of vertical. Best Regards, :-)
This comment was minimized by the moderator on the site
Dears Kindly note that I used Reference Same Cell From Multiple Worksheets With VBA Code and it works properly, but I need to modify something in the code and I need your help to make the values return in the master sheet horizontal instead of vertical. Best Regards, Mohamed AbdELhady
This comment was minimized by the moderator on the site
Is there a MAcbook version of this tool?
This comment was minimized by the moderator on the site
Hi I have just tried your vba code and it makes sense how to use it however on my master spreadsheet for this to work it is slightly more complicated firstly i'd want when i run the code for the results to populate horizontally secondly the cell id use as a reference like B6 is used doesnt correpsond on the other spreadsheets - so to explain the value id want to find appears in the same cell on each sheet but this doesnt correspond onto the master spreadsheet hope this makes sense please help!!
This comment was minimized by the moderator on the site
hi Thank you for you coding its really great and so much helpful for us. In this above VBA code how can I exclude the hidden worksheet? As I have different customer whom I billed them monthly using a format. So I have created few worksheet and hide them and from where I extract the different data from this hidden sheet. So please let me know the coding so that it doesn't pick the cell value from hidden worksheet. Your work is highly appreciated and thak you for your wonderful support! Regards Abhishek
This comment was minimized by the moderator on the site
How would I reference a specific cell as opposed to the cell that I have selected in another workbook?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations