Excel Macro for Searching Keywords in One Excel Work Book and Copy Entire Rows Having Those Keywords in Another Work Book

Saad Siddiqui

New Member
Joined
May 2, 2021
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
Hello...

I need help with Excel VBA/Macros. I have an excel file in which the the first sheet has a list of keywords and the second sheet has a database in which I want to search those keywords. I want an excel macro when run should search all those keywords in the database and copy all the rows in which those keywords are present. A new workbook should be created when the macro is run in which their are separate sheets for each keyword with data having those keywords.

The list of keywords can change and it should be dynamic. I can add more keywords in the list or I can delete some of them. Additionally, data is also not fix. It can change and I should have the possibility of searching the list of keywords in any other data that I copy in the second sheet of database I mentioned above.

I dont know how to attach the excel file over here as it is not showing the option for it. If someone can guide me, I can attach a sample file for better understanding.

An urgent response in this regard will be highly appreciated.

Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi,​
link your workbooks with a files host website …​
As a reminder 'urgent' is not appropriate on any forum where people help on their freetime for free !​
 
Upvote 0
Hi...

Thanks for the response. I am sorry. You are right about it. I will take care of it. Thanks for pointing this out. How can I send the samples files related to this? Cant I upload it over here?
 
Upvote 0
You have here the 'XL2BB' tool or just use a files host website …​
 
Upvote 0
In which column of the database - can't be as this is Excel ! - Sheet2 must be searched the keywords as the less columns the faster ?​
 
Upvote 0
As your Sheet2 does not respect Excel rules - no headers - one 'fast' and maybe the easiest way can not be used !​
Using any database software is the smart way as at least 50 times faster than under Excel (10 minutes, 20, 30, ?) …​
 
Upvote 0
Hi Marc

Regarding specific column in Sheet 2 to search for keywords, we can make the macro in a manner where we can just define the column number in the coding to search keywords in. This will make sure that we can change the column number in the coding of macro before running it if we want to search in a different column later on.

Regarding absence of headers in the database, you can just type in the headers as alphabets for the time being in order to use the easiest and fast way you mentioned in your message.

Thanks
 
Upvote 0
Regarding absence of headers in the database, you can just type in the headers as alphabets for the time being in order to use the easiest and fast way you mentioned in your message.
You can do it then attach the new sample workbook …​
Whatever the method using numbers or names I won't guess which are the columns to search within !​
The more columns, the slower … The more rows, the slower … The more keywords, the slower …​
As with the very bad idea to use Excel like a database software according to your sample workbook​
it should need more than half an hour and could be twice more if the search is on all columns …​
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top