Excel VBA Find All

限于喜欢 提交于 2019-12-08 06:39:31

ok, so the rule seems to be, if

Test1.column A is found inside Test2.column A
Test1.column B is found inside Test2.column B
Test1.column D is found inside Test2.column I
Test1.column E is found inside Test2.column I
Test1.column F is found inside Test2.column G

then copy Test1.column G to Test2.Column L

is that right?

Why can't you do that using a formula on Sheet2?

maybe: Test2.Column L formula = =IF(FIND(A:A,Sheet1!A:A)>0,Sheet1!G:G)

that formula needs an OR with the other conditions to make it check the other columns - will try after lunch!

if not, then ok, here I think we need to consider using ADO and treating the worksheet as a db table.

If you show what your source data looks like, and the result you need, I can try and write a sample for you, but by far the best option is for you to learn to fish using the below links.

see here for this: MSDN KB: How To Use ADO with Excel Data from Visual Basic or VBA

and also read: Treat Excel As a Relational Data Source on the Excel User MVP website

and also read: Office Space: Using ADO to Query an Excel Spreadsheet

basically the task is to read the filtered data that you need into an ADO Recordset, then use CopyFromRecordset method to dump the results into Sheet2 in one step

So you have some reading to do, let us know if you need an example or more help

Philip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!