+ Reply to Thread
Results 1 to 7 of 7

Range based on Table cell location

  1. #1
    Registered User
    Join Date
    07-31-2014
    Location
    Texas
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    49

    Range based on Table cell location

    I am simply trying to format a range of cells that are outside of the table using an offset from the tables DataBodyRange. I would like to do this in case the table gets moved, the formatting moves with it. The code format that I am using works for a single cell, but not a range of cells. I am missing something simple, but can't figure out what. This block of code works just fine:

    Please Login or Register  to view this content.
    But, if I change it to a range of cells, instead of a single cell, it throws an Error 1004:

    Please Login or Register  to view this content.
    What am I missing? I have used that format to set a range to multiple cells before, but VBA isn't liking it today, for some reason. Thanks in advance.

  2. #2
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,428

    Re: Range based on Table cell location

    Difficult to say without a sample file depicting your requirement...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    07-31-2014
    Location
    Texas
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    49

    Re: Range based on Table cell location

    An example has been attached. In the example, I am trying to change the format of sheet1.range("P10:R11") in VBA.
    Attached Files Attached Files

  4. #4
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,428

    Re: Range based on Table cell location

    Perhaps...
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-31-2014
    Location
    Texas
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    49

    Re: Range based on Table cell location

    Thank you. Do you know the reason that my multiple cell range was not working. I have set a range using that method before, but perhaps not outside the table. Would that be it?
    Last edited by LITOA; 05-21-2021 at 05:32 PM.

  6. #6
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,428

    Re: Range based on Table cell location

    AFAIK the range.resize is the only option relating to cells offset from actual table...

  7. #7
    Registered User
    Join Date
    07-31-2014
    Location
    Texas
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    49

    Re: Range based on Table cell location

    Thanks for the help. I have shunned tables up until now, so they are new to me. Building a new sheet with nothing but tables has been an eye opener. 👍

+ 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] Refer to cell location in table and insert related formula in cell location
    By LITOA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2021, 07:15 PM
  2. [SOLVED] Conditional Formatting based on cell / range id / location
    By drgkt in forum Excel General
    Replies: 8
    Last Post: 01-28-2017, 06:43 PM
  3. [SOLVED] Returning a value to a cell based off location in a table
    By lance.husak in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-10-2016, 09:35 AM
  4. [SOLVED] Selecting a Range based on location of a cell
    By spcw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2014, 03:09 PM
  5. Replies: 1
    Last Post: 08-18-2013, 05:00 PM
  6. [SOLVED] How to populate a table based on the cell location of given datas?
    By EllenS in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-22-2013, 09:49 PM
  7. Select a Range Based on Active Cell Location?
    By w01f in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2009, 08:35 AM

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