How to code a 'Search Button'

mssianlf

New Member
Joined
Aug 24, 2011
Messages
15
Hi,
I was looking for some help in coding a search button.

I need a single text box in which people can type a name and press go. I then need the data displayed in a user-form. already have the user form as it is the same format as the one I have created for data entry and the data returned needs to be editable. The data is held in one workbook and I only need two columns to be searchable.
I know there is a lookup option but tbh the people I have been charged with creating this for have trouble with ctrl+f ;).

I am sure this is a complicated and time consuming ask and will be grateful for any help anyone can offer as it took me nearly a whole week to make my user form work :)

Thank you in advance.

Sian
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Maybe I am just lazy, but I would just save the trouble and
Code:
Application.SendKeys("^f")
 
Upvote 0
For example if you put
Code:
Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("A1").Activate
Application.SendKeys "^f"
End Sub
When you click the button, it will pull up excels find & replace box
 
Upvote 0
Hi

Can you provide an example of what the users would type into the search box and what subsequent data would be returned to the userform?
 
Upvote 0
Hi,
They would be entering something like:

'NECO Ltd' or 'Joe Bloggs'

The data being returned is all held in the worksheet with ranges from 2 dates on a calender (start and end) Value in numbers names, email address, co name. contents of a couple of click boxes and a couple of dropdown boxes.
I tried to include a screen print so you could see the form but I cant make it work :)
 
Upvote 0
So there are multiple fields in each row that could contain the sought for data? Are there likely to be multiple rows that might contain the sought for data too? If so, which rows (records) would you want to return and how would you want this presented?

Do you just want to return the row numbers (or record IDs) of the rows that contain the sought for term?
 
Upvote 0
I hadn't actually thought of that? Would it be possible to highlight the rows or bring each set of data up one after the other in the form?
I am totally happy with just showing the relevant lines of data in the worksheet to the user.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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