+ Reply to Thread
Results 1 to 3 of 3

dynamic range defined in VBA for use in formulas

  1. #1
    yo
    Guest

    dynamic range defined in VBA for use in formulas

    Hi, I need some help with dynamic ranges and filling in formulas in the
    spreadsheet. Basically, I copied and pasted data into column A, which drives
    formulas in column B. The formulas in column B extend longer than the data
    in column A, so i end up with a bunch of zeros at the end. I used the
    following VBA code to define the non-zero range in column B.

    Dim LastRow As Long
    Dim rng As Range
    LastRow = Range("A65536").End(xlUp).Row
    Set rng = Range("B1:B" & LastRow)

    In column C of my spreadsheet are various percentiles that i need to find.
    here's my question: I want to fill in a formula in column D that uses the
    range that i defined in the VBA code and the percentiles stipulated in column
    C. How do I code that in VBA? Thanks for any help that you can provide!

  2. #2
    JE McGimpsey
    Guest

    Re: dynamic range defined in VBA for use in formulas

    I'd suggest that instead of using VBA, you use dynamic ranges defined as
    named ranges. Take a look at

    http://cpearson.com/excel/named.htm#Dynamic

    In article <[email protected]>,
    "yo" <[email protected]> wrote:

    > Hi, I need some help with dynamic ranges and filling in formulas in the
    > spreadsheet. Basically, I copied and pasted data into column A, which drives
    > formulas in column B. The formulas in column B extend longer than the data
    > in column A, so i end up with a bunch of zeros at the end. I used the
    > following VBA code to define the non-zero range in column B.
    >
    > Dim LastRow As Long
    > Dim rng As Range
    > LastRow = Range("A65536").End(xlUp).Row
    > Set rng = Range("B1:B" & LastRow)
    >
    > In column C of my spreadsheet are various percentiles that i need to find.
    > here's my question: I want to fill in a formula in column D that uses the
    > range that i defined in the VBA code and the percentiles stipulated in column
    > C. How do I code that in VBA? Thanks for any help that you can provide!


  3. #3
    Bob Phillips
    Guest

    Re: dynamic range defined in VBA for use in formulas

    Check column B

    LastRow = Range("B" & Rows.Count).End(xlUp).Row


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "yo" <[email protected]> wrote in message
    news:[email protected]...
    > Hi, I need some help with dynamic ranges and filling in formulas in the
    > spreadsheet. Basically, I copied and pasted data into column A, which

    drives
    > formulas in column B. The formulas in column B extend longer than the

    data
    > in column A, so i end up with a bunch of zeros at the end. I used the
    > following VBA code to define the non-zero range in column B.
    >
    > Dim LastRow As Long
    > Dim rng As Range
    > LastRow = Range("A65536").End(xlUp).Row
    > Set rng = Range("B1:B" & LastRow)
    >
    > In column C of my spreadsheet are various percentiles that i need to find.
    > here's my question: I want to fill in a formula in column D that uses the
    > range that i defined in the VBA code and the percentiles stipulated in

    column
    > C. How do I code that in VBA? Thanks for any help that you can provide!




+ 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