Results 1 to 3 of 3

find value in column with FindNext

Threaded View

  1. #1
    Registered User
    Join Date
    05-06-2010
    Location
    Sevilla, Spain
    MS-Off Ver
    Excel 2000
    Posts
    14

    find value in column with FindNext

    “Ctrl+F” and a value gives an output. For more entries click “Find Next” and repeat thid until the right content appears.
    I try to do this with an example file “cars.xls” and the following macro:

    Sub search()
    Dim InputValue As String
    Dim Rng As Range
    InputValue = InputBox("Enter a search item")
    With Sheets("Sheet1").Range("A:F")
    Set Rng = .Find(What:=InputValue, _
    LookIn:=xlValues, _
    LookAt:=xlPart, _
    SearchOrder:=xlByColumns, _
    SearchDirection:=xlNext)
    Cells.FindNext(After:=ActiveCell).Activate
    If Not Rng Is Nothing Then
    Application.Goto Rng, True
    Else
    MsgBox "Nothing found"
    End If

    End With
    End Sub

    When I enter the value “Peugeot” it shows only 1 result and then it stops. There is no button “Find Next” to click. In the example file there are 4 hits for the value “Peugeot”.
    What is going wrong with this macro?

    Thanks for your help
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1