Solved Excel Macro - Keep only columns with key words in them

August 18, 2015 at 21:08:28
Specs: Windows 7
I am very new to writing macros and I'm trying to find a macro that will search for a key word within the whole spreadsheet.
If the keyword is found in say 7 of the rows, those rows will remain and all others will be hidden (except for the first 4 rows as these have headings, etc.).

I would be very grateful to anyone who can point me in the right direction!

message edited by Adrian82

See More: Excel Macro - Keep only columns with key words in them

Report •

August 20, 2015 at 18:45:43
✔ Best Answer
I do not have access to Excel or VBA at the present time, so the best I can offer at this point is to suggest that you look up the VBA Find method via Google. You'll find various options for the use of Find and FindNext. Those are the methods that I would use to loop through your sheet, searching for the key word.

If I were to write code to do this, I would start by hiding all Rows (except for the rows with the headings) and then unhiding the rows where the key words were found. That way is easier than hiding rows which don't contain the keyword. Finding something with VBA and unhiding the row where it was found is much easier than not finding something and then hiding the row where it wasn't found.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •
Related Solutions

Ask Question