Create my own search function

burt0na

New Member
Joined
Aug 23, 2011
Messages
27
All,

I need to create a button that searches a list of names (Column A) and highlights/selects the name if its in the list, either via surname or firstname or both names.

The name is about 1000 lines long so when you type a name into a cell a formula either takes you to the name or via a click of a button.

I know i could use a Ctrl F to find any name but the powers that be want a button so a user can just type in there name on the sheet and click a single button

Any help you can give me would be appreciated

Andy
 

Some videos you may like

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.

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Something like this:

Code:
Sub test()

    Dim rngFindRange As Range
    With Sheets("Sheet1")
        Set rngFindRange = .Range("A1:A1000").Find(.Range("C1"), LookIn:=xlValues, lookat:=xlPart)
    End With
    If rngFindRange Is Nothing Then
        MsgBox "No match found", vbExclamation
    Else
        rngFindRange.Select
    End If
    
End Sub

The above searches for the value in C1 and looks in A1:A1000.

Dom
 

Watch MrExcel Video

Forum statistics

Threads
1,122,577
Messages
5,596,996
Members
414,116
Latest member
sfullnet

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
Top