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
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

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