+ Reply to Thread
Results 1 to 8 of 8

How do I create a range in VBA for multiple columns using a named range cell?

  1. #1
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    How do I create a range in VBA for multiple columns using a named range cell?

    Basically, I have one named cell as a reference, and I'd like to use VBA to change the cell colour for the named cell and the 4 columns to the right of it.

    Is there a way to create a new range in VBA using the named range as a starting point + 4 columns? Without selecting the range on the sheet and naming that range a new name.

  2. #2
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    Figured it out myself

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    @c.davidson
    And for people that are looking for a solution having the same problem, the answer is............
    Experience trumps academics every day of the week and twice on Sunday.

  4. #4
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    430

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    Thank you very much.
    Someone in the future will be happy with this.

  6. #6
    Forum Contributor
    Join Date
    10-06-2015
    Location
    Leeds, England
    MS-Off Ver
    365 Version 2302 Build 16.0.16130.20942
    Posts
    130

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    The way I did it was:

    Please Login or Register  to view this content.
    This is just an example to change the value of that range to 1, I wanted to change the interior colour.

  7. #7
    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,446

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    Or just this:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    PHP Code: 
    TMS           $B$6          $B$6:$F$6
    Sample        $B
    $2          $B$2:$F$2
    Named_Cell    $B
    $4          $B$4:$G$
    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


  8. #8
    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,446

    Re: How do I create a range in VBA for multiple columns using a named range cell?

    To change the Interior colour:

    Please Login or Register  to view this content.

+ 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. [SOLVED] Use INDEX formula to create dynamic named range with multiple columns?
    By kailaingrid in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-29-2023, 12:39 PM
  2. Replies: 3
    Last Post: 11-18-2021, 08:40 AM
  3. Create array in one cell as named range
    By jaryszek in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-21-2018, 12:39 AM
  4. [SOLVED] Compare cells to named range and create new sheets using related named range
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2015, 03:35 PM
  5. [SOLVED] Create the same named Range across multiple sheets
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-07-2015, 01:15 AM
  6. [SOLVED] Create named range for each cell
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-20-2012, 11:16 AM
  7. Create a dynamic range on named cell?
    By garyi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2011, 04:06 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