+ Reply to Thread
Results 1 to 3 of 3

find value in column with FindNext

  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

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: find value in column with FindNext

    Your post does not comply with the Forum Rules regarding use of code tags. All VBA code must be wrapped in code tags. Please edit your post to add them as required.

    Rule #3
    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Also, please DO NOT double post or start a new thread on the same topic.
    Here is the link to your current post on the same question: Find value in column
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

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

    Re: 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:

    Please Login or Register  to view this content.
    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

+ Reply to Thread

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