JSP
JSP

Reputation: 145

How to find the address of a cell found by LOOKUP and then fetch a corresponding cell?

So this is a new post, see the screen dump attached, please.

The code has to find the last non-zero value in Col A of this sheet and then fetch the value in Col C in the same row and paste it in C3.

Code:

Sub FindFetch()

' Find the last non-zero value in Col A and then fetch the corresponding value

    ActiveSheet.Range("A3").Formula = "= LOOKUP(2,1/(A10:A26>0),A10:A26)"
     ' Fetch the value in the corresponding column C:
     ' xxx <- this is my problem, how to get there
    ActiveSheet.Range("Cxxx").Copy
    Range("C3").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False

End Sub

Thank you very much in advance.

Upvotes: 0

Views: 35

Answers (1)

Ron Rosenfeld
Ron Rosenfeld

Reputation: 60484

= LOOKUP(2,1/(A10:A26>0),C10:C26)

Upvotes: 2

Related Questions