none
Resize property with Vlookup inside it RRS feed

  • Question

  • Hello guys !

    I´m trying to create a vlookup formula into a resize property as the sample below.

    Do you know the right way to do so?

    Sub Test
    Dim lookup
    Range("E1").Activate
    lookup = "=vlookup(1,R25C8:R36C10,3,0)"

    ActiveCell.Resize(1, lookup).Value = 2

    End Sub

    In this case my column may vary according to month of the year and how many weeks each month has.

    Regards,

    Flavio Aguiar

    Monday, September 25, 2017 9:06 PM

All replies

  • Try the following.

    Sub Test()
        Dim lookup
        Range("E1").Activate
        lookup = WorksheetFunction.VLookup(1, Range(Cells(25, 8), Cells(36, 10)), 3, 0)
        ActiveCell.Resize(1, lookup).Value = 2

    End Sub


    Regards, OssieMac

    Monday, September 25, 2017 11:52 PM