qwertyuu
qwertyuu

Reputation: 1065

Implementing Search As You Type in Excel 2003

I have a excel worksheet with thousands of records. I would find/implement a Search as you type application on Excel. Are there any plugins for Excel that does this? Or do I need to use VB to code this. If so, how do I go about it? Thanks.

For example, I want to highlight and jump to first matching cell as user types in the search term in a text box

Upvotes: 0

Views: 1485

Answers (1)

Adam
Adam

Reputation: 11

This is very simple to do using VBA and a form...

Enter the following in a regular Module:

Public Sub FindAsYouType()

    UserForm1.Show (False)

End Sub

And use something like the following in your code:

Private Sub txtFind_Change()
    Dim strFind As String
    Dim wks As Worksheet
    Dim varFound As Variant
    Set wks = ActiveWorkbook.ActiveSheet
    Set varFound = wks.UsedRange.Find(Me.txtFind, , , , , , True)
    If Not varFound Is Nothing Then varFound.Select
End Sub

Private Sub txtFind_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    If KeyCode = vbKeyReturn Then Unload Me
End Sub

I hope this helps someone else out there! :-)

Upvotes: 1

Related Questions