+ Reply to Thread
Results 1 to 9 of 9

Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

  1. #1
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    I have been googling for a couple of days now and cannot find any resources as to how to define the scope of a table in Excel. By default a table is created with workbook scope, and I want to know if it is possible to change that scope to a specific worksheet. There are plenty of resources on how this is done for named ranges, but they don't seem to apply to tables specifically.

    Another way that I could solve my problem is if it is possible to dynamically name tables within excel. This is another topic that I have googled for some time now and do not know if it is possible. It seems the table name can only be hardcoded in under the design section of the table tools ribbon. It would be great if I could set the table name via a formula so I could use a cell reference or a sheet name reference to dynamically name my tables.


    To give more context I have a worksheet that has many excel tables and I want to duplicate this worksheet many times and simply change the subject of the sheet. For example build it for state X, and then copy and change it to state Y. Everything is dynamic and functioning properly, but my table names are getting appended with large numbers (tableX is becoming tableX1234567895464136549, and it only gets worse with the more copies of sheets and I need to do 30+) to keep them unique since their scope is global. This distracts from the readability of the formulas throughout the spreadsheet, which is one of the great values the tables are adding. I would rather not go through each individual sheet and manually re-name the tables as that is not a robust solution when future changes inevitably come about. If I could define the scope of the tables to be sheet specific, this solves my problem as does dynamically assigning the table names.

    Thoughts?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    How are you naming the tables on the 'original' sheet?

    Are you accepting the default name(s) they are given when created or renaming them with something meaningful?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    I am renaming them with something meaningful.

  4. #4
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    Even finding out that these things are not possible would be very beneficial so I can start moving forward with some alternate solutions. Thanks for the consideration!

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    Short answer, no it's not possible to define/set the scope of a table in Excel.

    What you could do is use a name for each table that is both meaningful in the context the sheet is on and what it's purpose is.

    For example, let's say you have an Employees table on your 'template' sheet.

    Now you want to create a copy of this sheet, and it's table, for each of the divisions, e.g. Division1 and Division2, in your company.

    So you copy it twice and rename the new sheets appropriately.

    You could then go onto rename the tables in the new sheet Employees-Division1 and Employees-Division2.

  6. #6
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    Yeah, that is what I was afraid of. I was hoping to avoid manually renaming the roughly 900 tables (about 30 on the template sheet and then roughly 30 copies) and the number of sheets is not static so in the future more sheets will be added and then with the add comes the manual renaming step again. I really don't understand why you can't set table names via a formula. That is what I was hoping to do and just slap a meaningful prefix on the table name that is defined by the sheet name. Oh well, thanks for the feedback!

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    You could use some simple code to copy the 'template' sheet and rename the tables in the new sheet.

  8. #8
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    My VBA is weak at best, any chance you could provide a generic example?

  9. #9
    Registered User
    Join Date
    11-06-2018
    Location
    Ohio
    MS-Off Ver
    365
    Posts
    8

    Re: Defining the Scope of an Excel Table or Dynamically Assigning a Table Name

    I was able to write some VBA to do the renaming in an automated fashion, so thank you for the suggestion!

+ 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. data table - scope to sheet ??
    By zico8 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2016, 03:29 PM
  2. [SOLVED] Dynamically increase # of table rows based off another table
    By michellepace in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-01-2015, 05:16 AM
  3. Defining scope of functions.
    By FrenchMassacre in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2015, 11:20 AM
  4. Replies: 0
    Last Post: 01-26-2015, 05:31 PM
  5. Table based on another Table, add new rows dynamically?
    By Jhail83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2013, 11:43 AM
  6. Change size of Excel Data Table, dynamically
    By joshjpang in forum Excel General
    Replies: 10
    Last Post: 02-08-2013, 06:26 AM
  7. [SOLVED] Query Table Ranges, Not Within Scope of Workbook
    By gjohn282 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2013, 09:02 PM

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