+ Reply to Thread
Results 1 to 3 of 3

Assigning unique names to cells in tables

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    Johanesburg
    MS-Off Ver
    Office 2007, 2010
    Posts
    2

    Assigning unique names to cells in tables

    i there,

    Im looking to assign all the cells in a table unique names based on the column and row headers.

    The table below is an example of a table with values ranging from 1 to 25. They will be uniquely used later on for other calcs. Also note that the table size isnt fixed to 5x5 and will more likely range from 10x8 but this is just to show my idea/problem.

    Reference Col 1 Col 2 Col 3 Col 4 Col 5

    Row 1 value 1 value 2 value 3 value 4 value 5
    Row 2 value 6 value 7 value 8 value 9 value 10
    Row 3 value 11 value 12 value 13 value 14 value 15
    Row 4 value 16 value 17 value 18 value 19 value 20
    Row 5 value 21 value 22 value 23 value 24 value 25

    The cells "value 1" through "value 25" should be assigned names so that the other program can call them directly where needed. I would like thus to assign the following names to the cells which can be derived by some concatenating and string editing. (in this case each sell name should be derived with =CONCATENATE("S",C$8,$A11) depending on where the table is located. This is also why I put in the reference cell in the top-left corner because that way the macro can pinpoint the table.

    Reference Col 1 Col 2 Col 3 Col 4 Col 5

    Row 1 SCol1Row1 SCol2Row1 SCol3Row1 SCol4Row1 SCol5Row1
    Row 2 SCol1Row2 SCol2Row2 SCol3Row2 SCol4Row2 SCol5Row2
    Row 3 SCol1Row3 SCol2Row3 SCol3Row3 SCol4Row3 SCol5Row3
    Row 4 SCol1Row4 SCol2Row4 SCol3Row4 SCol4Row4 SCol5Row4
    Row 5 SCol1Row5 SCol2Row5 SCol3Row5 SCol4Row5 SCol5Row5

    My Question: Is there a Macro that I can use to give the names to the cells based on their column and row headers.
    Bonus points for a macro that first checks the dimensions of the table/array pleas?

    Thanks for any help possible.

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Assigning unique names to cells in tables

    I would name only the upper left cell in the table and then find other cells with =OFFSET(reference_cell, rows_down, columns_right), since you're going to have to choose the row and column numbers as inputs anyway.

    No macro needed and you avoid the despised CONCATENATE function.
    Last edited by ben_hensel; 07-12-2012 at 09:22 AM. Reason: transposed words "right" and "down"

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    Johanesburg
    MS-Off Ver
    Office 2007, 2010
    Posts
    2

    Re: Assigning unique names to cells in tables

    Quote Originally Posted by ben_hensel View Post
    I would name only the upper left cell in the table and then find other cells with =OFFSET(reference_cell, rows_right, columns_down), since you're going to have to choose the row and column numbers as inputs anyway.

    No macro needed and you avoid the despised CONCATENATE function.
    Hi Ben,

    Thanks for the reply, although the whole idea of the macro required is to give the cells names. The program that draws information from the sheet is called Aspen and requires the names to populate data sheets through calculations.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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