Search text in multiple columns and return all rows

maggsy

New Member
Joined
Jun 4, 2003
Messages
12
I have a worksheet where users can search for all suppliers of a certain item. At the moment they enter their search term in a dialogue box and I then use the advanced filter funtionality to show all rows containing that value. (code below)
However I need to be able to search in more than one column, is there a way to do this?
e.g.
Column A Column B Column C
Supplier 1 - Electrical pumps - inline
Supplier 2 - Impellors - pump spares
Suppplier 3 - valves - hydraulic

If user was to enter 'pump' rows 2 and 3 need to be shown, currently it will only show row 2 as it is filtering on column 2

Any help or sugggestions would be much appreciated


Sub Find_cat()
'
' Find Macro

Dim catvalue
Application.ScreenUpdating = False

catvalue = InputBox("Please enter the item you are searching for", "Category Search")
Sheets("Table").Select
ActiveSheet.AutoFilterMode = False
ActiveSheet.Range("A:s").AutoFilter

ActiveSheet.Range("A$1:$S$987").AutoFilter Field:=8, Criteria1:="*" & catvalue & "*"
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi

If using Excel 2007/Excel 2010, the following works for me (although it's not using VBA code):

First, have the following in column D and copy down:
=concatenate(B1,C1)

Then, put on a filter, click on the filter, then "text filters", "contains", and then enter the desired string (e.g. pump)

M
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,729
Members
449,049
Latest member
MiguekHeka

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