VBA based search function

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello,

I am trying to create a search function, and could use a little assistance. In C3 & C4 I have two drop down boxes. Each one contains identical options and return a value of 1-8. I need a way to search all the rows below for matching values and hide all rows except those that match.
Example 1: C3 has a value of 3, I will search and all rows that has a value of 3 in column C or Column D will be unhidden.
Example 2: C3 has a value of 2, and D3 has a value of 7, I will search, and all rows that have both a value of 2 in column C and a value of 7 in column D will be unhidden.

I hope this makes sense to somebody more skilled than I.

- Andrew


Also,
Another thing I am trying to do is a search by date, (located in column b). I am thinking about just doing a separate search function for that, but if it could be included in with the other one, that would be cool too.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I'm looking for something a little easier to use. I have no problem with it, but the people using this sheet are not computer or excel savvy. That would be too much effort for them, plus the way I have the data setup, would make the searching part difficult. (For example #6 is actually 'Marketing Event', I just have excel return a value of 6.)
 
Upvote 0
Any solution will require a macro, so why don't you write one that AutoFilters the data with your given criteria?
 
Upvote 0
I'm not entirely sure how I would do that. I know how to use the macro recorder, but not sure how that would help with various search #'s
 
Upvote 0
You would need to amend your recorded code so that the Criteria referred to your dropdown rather than a constant.
 
Upvote 0

Forum statistics

Threads
1,203,601
Messages
6,056,212
Members
444,850
Latest member
dancasta7

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