Consulting

Results 1 to 3 of 3

Thread: Solved: VBA to find last populated cell but ignore formulas returning blank

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    76
    Location

    Solved: VBA to find last populated cell but ignore formulas returning blank

    Hi,

    I have the line below that finds the last populated cell in the column but I need it to ignore any cells that have a formula returning no value.

    Range("A2000").End(xlUp).select

    So for example, cells A1 to A6 contain a fomula that returns a value if a criteria is met and "" if it is not. When I run the code it takes me to cell A6 even though there is no value in it. I want the code to take me to the cell with the last populated value - cell A3.

    A1 454
    A2 475
    A3 784
    A4
    A5
    A6

    Is this possible?

    Thanks

    Hamond

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Cells(Application.Evaluate("MAX(IF(A1:A2000<>"""",ROW(A1:A2000)),0,1)"), "A").Select
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Dec 2007
    Posts
    76
    Location
    Thanks XLD

    I've tested this out and gives me what I need.

Posting Permissions

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