跳到主要内容

如何从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 ...时,此公式才有效


将多个工作表中的同一单元格引用到一个主表中

Kutools for Excel 支持强大的功能-动态参考工作表 这可以帮助您将多个工作表中的相同单元格值引用到主表中。 请参见下面的演示。    点击下载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代码,请在这里为您介绍一个有用的工具- Kutools for Excel,其 动态参考工作表 实用程序,您可以轻松地从Excel中的多个工作表中填充单元格引用。

提示:申请这个 动态参考工作表 功能,首先,您应该下载 Kutools for Excel,然后快速轻松地应用该功能。

安装后 Kutools for Excel,请这样做:

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 Tab 为 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