+ Reply to Thread
Results 1 to 11 of 11

Named Range using Dynamic Range

  1. #1
    Registered User
    Join Date
    11-15-2022
    Location
    Washington State, USA
    MS-Off Ver
    360 ProPlus
    Posts
    31

    Named Range using Dynamic Range

    Is it possible to include dynamic range as part of a formula for a range name? This is what I am trying to do:Name Range Definition: MasterData!("A3"):Range("A3").End(xlDown).Row

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,675

    Re: Named Range using Dynamic Range

    Are you trying to write a formula for a named range, write some VBA code, or...what? What you have written above is not a valid formula or valid VBA.

    It is possible to define a dynamic named range. For example, this formula defines the range of data in column A, assuming no holes in the data:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-15-2022
    Location
    Washington State, USA
    MS-Off Ver
    360 ProPlus
    Posts
    31

    Re: Named Range using Dynamic Range

    This works if the table is on Sheet1 but how would you identify the table if the range is on Sheet2

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,318

    Re: Named Range using Dynamic Range

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    11-15-2022
    Location
    Washington State, USA
    MS-Off Ver
    360 ProPlus
    Posts
    31

    Re: Named Range using Dynamic Range

    The =OFFSET(Sheet2!A3,0,0,COUNTA(Sheet2!A:A)) returns Reference isn't valid. I am using the Name Manager for the formula.
    Last edited by TeacherWart; 12-11-2022 at 09:02 PM.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,318

    Re: Named Range using Dynamic Range

    Do you have a Sheet2? And is there data in cells A3:A325?

  7. #7
    Registered User
    Join Date
    11-15-2022
    Location
    Washington State, USA
    MS-Off Ver
    360 ProPlus
    Posts
    31

    Re: Named Range using Dynamic Range

    Yes I do. Sheet2 is named "MasterData" and there is data in Column A of that Worksheet. Currently I have 285 rows of data but left more for additional data. Originally what I wanted to do was make the range dynamic so I didn't have to define the range as $A$3:$A$325. Is there a way to programmatically name and define the dynamic range and include in the Worksheet_Open module?
    Last edited by TeacherWart; 12-11-2022 at 10:38 PM.

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

    Re: Named Range using Dynamic Range

    In vba, you would create a variable, not a named range, and set it to the desired range:
    Please Login or Register  to view this content.
    If Sheet2 happens to have tabname, say, MasterData, then you could write, e.g.,
    RowCount = Sheets("MasterData").Cells(Rows.Count, "A").End(xlUp).Row
    Ben Van Johnson

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,318

    Re: Named Range using Dynamic Range

    Named Range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-15-2022
    Location
    Washington State, USA
    MS-Off Ver
    360 ProPlus
    Posts
    31

    Re: Named Range using Dynamic Range

    The Set MyRange = Sheet2.Range("A1:A" & RowCount) line produces an "Object required" error.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,973

    Re: Named Range using Dynamic Range

    This is confusing.

    1. Do you want a formula that delivers a Named Range, or VBA?

    2. What is IN Sheet 2 A3, downwards. TEXT or NUMBERS or a MIXTURE?

    3. Are they entered there DIRECTLY, or as a result of a FORMULA?

    A sample sheet would clear all this confusion up (Yellow banner - top of screen)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

+ 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. Creating a named range which refers to a dynamic range with VBA
    By Pete000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2019, 06:02 PM
  2. [SOLVED] dynamic named range not populating combo box list if range = single cell
    By HeyInKy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-24-2014, 05:27 PM
  3. Dynamic / Named Print Range To Include Another Range of Cells
    By thekrakenwakes in forum Excel General
    Replies: 0
    Last Post: 07-25-2014, 07:52 AM
  4. [SOLVED] creating a named range taking the avg. to date of a dynamic range.
    By siggisigg in forum Excel General
    Replies: 1
    Last Post: 07-15-2014, 08:58 AM
  5. [SOLVED] Dynamic Named Range to Auto-Populate another range based on criteria
    By BeachRock in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 06:46 PM
  6. [SOLVED] Dynamic Named Range Help - Range Based on Values in Column
    By Filibuster in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-03-2012, 11:13 AM
  7. [SOLVED] getting the absolute range address from a dynamic named range
    By junoon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2006, 09:30 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