+ Reply to Thread
Results 1 to 3 of 3

refer to dynamic range in code

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    refer to dynamic range in code

    Hi all,

    I want to refer to a range within my code, but that range should change depending on what is selected in my combo box. Basically I would have hundred of ranges such as e.g.

    MTR_CHN_TTL_RTL
    MTR_CHN_DTC_RTL
    MTR_CHN_DTC_CST
    MTR_KOR_TTL_RTL
    MTR_JPN_DTC_RTL
    MTR_JPN_DTC_RTL

    where the first part of the range name "MTR" always stays the same and the second part e.g. "JPN" changes depending on the region I select in my combo box, so it should take it from the defined range "Selected_Region", the third part e.g. "TTL" changes depending on the range "Selected_WHSL" and the last part e.g. "RTL" changes depending on the metric selected Range("Selected_Metric). How can I write that in my code to always add the correct range depending on what is selected?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: refer to dynamic range in code

    Hi,

    Perhaps this
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: refer to dynamic range in code

    Yup. That works! Thank You!!

+ 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. How to refer a combobox with a dynamic worksheet.
    By mycllee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2017, 08:37 PM
  2. [SOLVED] My code is not dynamic; it has a pre-defined range. Possible to change code?
    By mick0005 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-20-2015, 10:23 PM
  3. Code to refer to Dynamic Range
    By philozelda in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2014, 04:37 PM
  4. [SOLVED] Cannot refer to a dynamic range in a closed workbook
    By BNCOXUK in forum Excel General
    Replies: 7
    Last Post: 01-07-2014, 09:56 AM
  5. Problem changing R1C1 code to refer to specific, asbolute range
    By MichaelMcF in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2011, 01:13 PM
  6. How to refer code to specific range in worksheet
    By gulaina in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2010, 04:16 AM
  7. refer to dynamic range in closed workbook with ADO
    By MattShoreson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2005, 06:26 AM

Tags for this Thread

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