在另一个工作簿中查找匹配的单元格值并返回匹配的行内容
我是 Excel 和 VBA 新手,面临以下任务:
我有两个工作簿 - wookbook1.xlsx
包含公司名称并将保存宏,workbook2.xlsx
> 它将保存我需要与 workbook1
进行匹配的值。对于 workbook1
中的每个公司名称,我需要获取在 workbook2
中找到匹配项的行值。
请帮忙。
I'm new to Excel and VBA and am faced with the following task:
I have two workbooks - wookbook1.xlsx
contains company names and will hold a macro, and workbook2.xlsx
which will hold the values I need to match against from workbook1
. For each company name in workbook1
, I need to get the row value where a match is found in workbook2
.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 iDevlop 在他/她的评论中指出的那样,您不必使用 vba,而是使用公式。
以下是一些可帮助您构建正确公式的链接:
VLOOKUP
公式将帮助您在另一个数组中查找匹配值:http://www.techonthenet.com/excel/formulas/vlookup.phpINDEX
公式将帮助您找到对应的行或列(又名索引)在另一个数组中:http://www.contextures.com/ xlfunctions03.html如果您无法获取它,请使用您尝试过的内容以及您想要做的更深入的示例来编辑您的第一篇文章。
问候,
As iDevlop pointed out in his/her comment, you don't have to use vba but rather a formula.
Here are a few links to help you in building the right formula:
VLOOKUP
formula will help you find the matching value in another array: http://www.techonthenet.com/excel/formulas/vlookup.phpINDEX
formula will help you find the corresponding row or column (a.k.a. index) in another array: http://www.contextures.com/xlfunctions03.htmlIf you can't get it, please edit your first post with what you tried and a deeper example of what you are trying to do.
Regards,
可以使用用户窗体搜索工作簿工作表之间的匹配单元格。
当双击要搜索的单元格时,用户窗体打开,匹配的单元格可以在用户窗体列表框控件上看到工作表名称和单元格地址。列表框中选定的单元格地址成为活动单元格。
用户表单的 VBA 代码:
源代码和示例文件地址
Matching cells between sheets of the workbook can be searched using the userform.
When the cell that to be searched is double-clicked,userform opens and the matching cells can be seen as sheet name and cell address on the userform listbox control.The selected cell addresses in the listbox become active cell.
VBA codes of userform:
Source and sample file address