Immutable identifier for ListObject

ttt123

Board Regular
Joined
May 31, 2006
Messages
120
Office Version
  1. 365
Platform
  1. Windows
Is there any way to get an immutable identifier for a ListObject?

A ListObject has a Name and Index property and belongs to a parent worksheet, but suppose I have a ListObject called 'Table1' and then I delete that table and then add a new ListObject also called 'Table1' that also has Index=1, is there any way I can definitively tell that the new ListObject is not the original?

For example a Worksheet object has the immutable property CodeName. Or alternatively, you could add a UUID/GUID to a worksheet's CustomProperties to be able to uniquely identify it.

Is there any similar method that I could use to identify a ListObject without directly storing a reference to it and being able to identify it regardless of whether it's Name, DisplayName, Index, headers, or Range change over time?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You could create a new class that holds a ListObject and on creation of the class makes a static identifier (i.e. date/time).
 
Upvote 0
The OP scenario is not completly accurate.
If one creates a worksheet, changes its code name, deletes it and creates a new worksheet, the new worksheet may have the codename that the now-deleted sheet had.

The problem is that with all classes, if you delete an object, everything about that instance disappears.

I would suggest that in a hidden part of the worksheet you put a little chart with NameOfListObject as one column and VersionNumber as the second column. That would persist between openings of Excel.

Edit:
On reflection, it seems like all the bells & whistles methods about custom object and discreet cells is way too much work.

You could use the .AlternativeText argument of the existing ListObject to store the version number and NOT delete the list object, just clear it and re-assign the range as needed.
 
Last edited:
Upvote 0
Thanks for the suggestions. The .AlternativeText and .Summary properties can be manually changed by the user as they may use them to describe the table. I was hoping to find something that would be completely hidden from the user (not necessarily immutable but something like Range.ID, Worksheet.CustomProperties or Workbook.CustomXMLParts where I could add a GUID and not really worry about it being accidentally changed). Also, I don't want to be changing any cells in the underlying worksheet.
 
Upvote 0
also .AlternativeText and .Summary are not available in Excel 2007, only 2010 and higher
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top