Vlookup 到另一个工作簿
这是我的困境。
我有两张工作表,一张包含客户姓名,另一张我想根据城市将姓名复制到其中。
例如:
与每列关联的是姓氏、名字和城市。 我有数百个与不同城市相关联的名字,我想要的是从worksheet1.xls将所有纽约客户复制到worksheet2.xls,无论是当我打开worksheet2时还是通过宏,哪个更容易,因为姓氏在一个单元格中并且第一个名字在另一个中,我必须复制两个名字。
我发现可以将单元格从一个工作表链接到另一个工作表,然后根据条件进行 vlookup。这是最好的最简单的方法还是还有其他方法?
Here is my dilemma.
I have two worksheets one that has the name of clients and one that i want to copy the names to depending on the city.
For instance:
associated to each column is last name, first name and city.
i have hundreds of names associated to different cities and what i would like is from worksheet1.xls to copy all the New York clients to worksheet2.xls either when i open worksheet2 or via macro what ever is easier and because last name is in one cell and the first name is in the other i would have to copy both.
I saw that its possible to link cells from one worksheet to another and then do a vlookup depending on the criteria. Is that the best easiest way or is there another?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
执行此操作的一种方法是在工作表 2 中添加查询工作表 1 的远程数据引用。
然后,当您打开工作表 2 时,刷新数据以从工作表 1 获取最新数据,
例如
这不是语法正确的查询,请使用查询编辑器帮助您构建它
。如果您需要帮助,请包括您正在使用的 Excel 版本。
One way to do this is to add a Remote Data reference in worksheet2 that queries worksheet1.
Then when you open worksheet2 you refresh the data to get latest from worksheet1
Something like
This is not a syntactically correct query, use the query editor to help you build it
If you need help, please include the version of Excel your are using.
我可以提供这个宏作为答案,它有以下改进空间:
这是代码
希望这有帮助
最好的问候
艾伦
I can offser this macro as answer, it has the following room for improvement:
this is the code
Hope this helps
Best Regards
Alen