+ Reply to Thread
Results 1 to 2 of 2

How to form a range name from strings

  1. #1
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    How to form a range name from strings

    I have a number of ranges on a worksheet whose names differ by two digits (i.e., a two digit year). Examples are '_17_data', '_18_data', '_19_data', representing different ranges for data corresponding for years 2017, 2018 and 2019.

    Is there a way to construct the range name in VBA from a variable (yr); i.e., something like rng = "_" & yr & "_data"?

    Thanks.

  2. #2
    Forum Contributor
    Join Date
    07-16-2007
    MS-Off Ver
    Excel 2003 and Excel 2016
    Posts
    178

    Re: How to form a range name from strings

    Never mind. Got it. Set rng = range("_" & yr & "_data")

+ 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. Splitting Name from Cells to feed back into Multipage Form - More than 2 Strings
    By snuffnchess in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2019, 07:03 AM
  2. Named range using indirect and cells containing range strings
    By vikas.trades25 in forum Excel General
    Replies: 12
    Last Post: 05-08-2019, 02:28 PM
  3. Replies: 3
    Last Post: 08-22-2018, 06:42 PM
  4. Swap Specific Text Strings in a Range and Indicate new Strings Not already in Code.
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2018, 01:31 PM
  5. Find two strings in a range select cells in between and loop through range
    By maxwell13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2018, 04:04 AM
  6. Search range of strings with a range of keywords and highlight matches
    By efillner in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 04:07 PM
  7. Replies: 3
    Last Post: 03-04-2011, 02:25 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