+ Reply to Thread
Results 1 to 9 of 9

Finding and using the row number for subsequent finds.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Finding and using the row number for subsequent finds.

    I would like to find a value from a table. 10 000 + rows and 90 columns.

    The primary values is somewhere in the middle and can be in a diffirent column.

    With the row number I want to find 8 more values from diffirent columns.

    Within all this confusion the only constant is the colomn headers

    I tried the ROW, ADRESS, INDEX and ADDRESS functions and I could not get any one or combination to work.

    Please help.

  2. #2
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Finding and using the row number for subsequent finds.

    Fake.xlsx

    The fields I want to find is ID Number, Surname, Initials, Full Names, Gender and a few more.

    The data is in a seperate file and can NOT be edited.

    The file attached is a small (fake) version of the full one.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Finding and using the row number for subsequent finds.

    What actually you want is not understood.Is it possible to explain with example or before and after sheets.

  4. #4
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Finding and using the row number for subsequent finds.

    Input_Output.xlsx

    Here is the Input Output page that works with the previous one "fake.xlsx"
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Finding and using the row number for subsequent finds.

    Input_Output.xlsx

    Oops I added the wrong file.

    If someone can just help me to return the row number I will be able to get the rest (cowboy style)
    here is the right file

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Finding and using the row number for subsequent finds.

    To find row of say TEX use this command.

    FRO=Cells.Find(What:="TEX", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False).Row
    To find row of say TEX after this use this command.

    FRO=Cells.Find(What:="TEX", After:=Range("A" & FRO), LookIn:=xlFormulas, LookAt:= _
            xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
            , SearchFormat:=False).Row

  7. #7
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Finding and using the row number for subsequent finds.

    I tried this code but it seems that forum makes me look like a newby.

  8. #8
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Finding and using the row number for subsequent finds.

    I have tried many other ways and have made positive progress and will post the results when I have it.

  9. #9
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Thumbs up Solved: (but not completed) Finding and using the row number for subsequent finds.

    Ok guys I have a solution. I thought I knew a lot until I got here. Thanks hay.

    This is a group of may functions and I know someone here can do it better and I will welcome any comments.

    First declare the variables
        Dim row, value, val3 As Variant
    Next set the variables
        value = Range("G3").value
        val3 = Range("F3").value
    F3 has the header and G3 the value

    Now find and select the Column with the same header

        Rows("1:1").Select
        Selection.Find(What:=val3, After:=ActiveCell, LookIn:=xlValues, _
            LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
        ActiveCell.EntireColumn.Select
    Now find the value within the selected range and set the last "row" variable

        Selection.Find(What:=value, After:=ActiveCell, LookIn:=xlValues, _
            LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
        row = ActiveCell.row
    I do have a problem with the value lookup where the code crashes if the value is not found.

    The "row" variable can now be used in a cell or the vb code in conjunction with the hlookup function.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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