Consulting

Results 1 to 4 of 4

Thread: Find Contents of cell

  1. #1

    Find Contents of cell

    I have a spread sheet using the MAX command to find the max number in column
    F. When it finds the number how do I find the contents of the matching cell in
    column A. I am thinking I need to use the IF statement but from there I am stuck. Thanks for any help with this.
    Max

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    [VBA]
    Option Explicit
    Sub FindMaxCell()

    Dim maxRng As Range, maxCell As Range
    Dim iMax As Variant, thisValue As Variant

    Set maxRng = Columns(6)

    iMax = Application.Max(maxRng)

    Set maxCell = maxRng.Find(What:=iMax)

    thisValue = maxCell.Offset(0, -5).Value

    MsgBox thisValue

    End Sub
    [/VBA]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    =INDEX(A:A,MATCH(MAX(F:F),F:F,0))
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Thanks for the help.
    Max

Posting Permissions

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