+ Reply to Thread
Results 1 to 5 of 5

Using dynamic ranges – is this next step possible?

  1. #1
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Using dynamic ranges – is this next step possible?

    I’ve got vba code which dynamically redefines a range and assigns it to a defined range name on a worksheet. Then I used INDIRECT to use the range name in various formulas as follows – note how I assign the range to range name “iStopList” and then use it in a worksheet formula.

    Please Login or Register  to view this content.
    Two questions. 1) Is it possible to use the range defined on a worksheet in a vba line of code? For instance, if LRowST=69, rather than rather than writing the first line of code, could I used the range name as in the second example using some equivalent to INDIRECT?

    Please Login or Register  to view this content.
    2) If that is possible, is there a way to use something like OFFSET so that I could use iStopList as the anchor but select the cells in the next column to the right ("L6:L69")?
    I haven’t been able to figure it out / or find anything on the web. Thanks for reading and I appreciate any help.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Using dynamic ranges – is this next step possible?

    You explanation is a little foggy, but:
    Please Login or Register  to view this content.
    debug window:
    IstopList address: $K$6:$K$69
    offset address is: $L$6:$L$69
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Using dynamic ranges – is this next step possible?

    protonLeah – sorry my explanation must have been more than a little foggy to send you off track. Let me try again. I have created and attached an example workbook. I have vba that creates the range addresses stored in column L of the worksheet (not included). The workbook has a sample macro to show how I currently define the range in VBA to copy selected cells (I’m not really copying, but this is an easy example to show what I’m trying to do). What I’m currently doing works fine, but it seems like I’m somewhat recreating the wheel since I’m basically redefining the range twice – once for use in worksheet formulas (the original purpose of putting them in worksheet cells) and once in VBA to do other non-worksheet formula manipulation.

    I’ve added comments in the macro to hopefully clarify my original questions. Hope this will help you cut through my fog – thanks for your help.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Using dynamic ranges – is this next step possible?

    ...I have already saved the range definition in cell T2 (range name "iStopList") on Worksheet "Initial Stops"...
    ...Q1 is where it's possible to use that definition in vba such as...
    Please Login or Register  to view this content.
    ...This doesn't work - only copies cell T2 and I cannot find an equivalent to the worksheet function of Indirect for use in VBA. ...

    One Option:
    Please Login or Register  to view this content.
    'Q2 - if Q1 is possible can I use it to identify the same cells in column L or would I need to create a new name range cell on the worksheet to store L2:L12"
    Please Login or Register  to view this content.
    Last edited by protonLeah; 09-20-2018 at 10:17 PM.

  5. #5
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Using dynamic ranges – is this next step possible?

    Perfect! I figured there was a way to do this – only required someone smarter than me to turn the light on in the room. Thanks for your assistance!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 07-07-2017, 01:24 PM
  2. VBA Code works by step by step, doesn't work by running
    By lucasar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2016, 06:33 AM
  3. [SOLVED] Quickfill dynamic formulas the step by column
    By mmartin1212 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-18-2015, 01:49 PM
  4. [SOLVED] Stock Chart apparence is different if Macro1 runs step by step not directly !
    By HerryMarkowitz in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-23-2014, 04:31 AM
  5. [SOLVED] For step loop, need step size to change based on reference cell in row
    By Telperion in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2013, 03:41 PM
  6. Dependent validation to narrow down selection choices step by step
    By saschagraef in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2010, 07:25 AM
  7. Dynamic Step Chart using range names
    By Michel Gerday in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 02-28-2006, 09:10 PM

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