vba 在另一个工作簿中查找匹配的单元格值并返回匹配的行内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6788509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:41:42  来源:igfitidea点击:

find matching cell value in another workbook and return matching row content

excelsearchexcel-vbalookupvba

提问by noni

I'm new to Excel and VBA and am faced with the following task:

我是 Excel 和 VBA 新手,面临以下任务:

I have two workbooks - wookbook1.xlsxcontains company names and will hold a macro, and workbook2.xlsxwhich 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.

我有两个工作簿 -wookbook1.xlsx包含公司名称,并将包含一个宏,它将包含workbook2.xlsx我需要匹配的值 from workbook1. 对于 中的每个公司名称workbook1,我需要获取在 中找到匹配项的行值workbook2

Please help.

请帮忙。

回答by JMax

As iDevlop pointed out in his/her comment, you don't have to use vba but rather a formula.

正如 iDevlop 在他/她的评论中指出的那样,您不必使用 vba 而是使用公式。

Here are a few links to help you in building the right formula:

以下是一些可帮助您构建正确公式的链接:

If 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,

问候,