+ Reply to Thread
Results 1 to 2 of 2

Range Definition in Macro ?

  1. #1
    Baapi
    Guest

    Range Definition in Macro ?

    Hi,
    Take this formula below...
    VLOOKUP($F2,Calculations!$C$2:$C$25000,3,FALSE))

    Now, I want "$25000" to be defined as a Range in a Macro. I have my raw data
    varying from 1000 to 30000 everyday. If use this above formula, Excel
    calculates for a long long time.

    Instead I want to define a range in the macro and use that Range Name in
    this formula.
    One more thing, Range should have only the Row number (ex: 25000) and not
    the column index (A, B...)

    Ideally I want my formula to look like...
    VLOOKUP($F2,Calculations!$A$2:$C RangeName,3,FALSE))

    I know this syntax is wrong...

    Is there a method?
    --
    Thanks
    Baapi

  2. #2
    Rowan
    Guest

    Re: Range Definition in Macro ?

    Try:

    Dim eRow As Long
    eRow = Sheets("Calculations").Cells(Rows.Count, 3).End(xlUp).Row
    ActiveCell.Formula = "=VLOOKUP(F2,Calculations!$A$2:$C$" _
    & eRow & ",3,FALSE)"


    Hope this helps
    Rowan

    Baapi wrote:
    > Hi,
    > Take this formula below...
    > VLOOKUP($F2,Calculations!$C$2:$C$25000,3,FALSE))
    >
    > Now, I want "$25000" to be defined as a Range in a Macro. I have my raw data
    > varying from 1000 to 30000 everyday. If use this above formula, Excel
    > calculates for a long long time.
    >
    > Instead I want to define a range in the macro and use that Range Name in
    > this formula.
    > One more thing, Range should have only the Row number (ex: 25000) and not
    > the column index (A, B...)
    >
    > Ideally I want my formula to look like...
    > VLOOKUP($F2,Calculations!$A$2:$C RangeName,3,FALSE))
    >
    > I know this syntax is wrong...
    >
    > Is there a method?


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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