excel vba - Using VBA to return the Table Name corresponding to a given ActiveCell Selection -


for given activecell in excel how can vba return table name appears in properties grouping becomes visible when table tools design tab activated. example in immediate window:

?activesheet.listobjects(2)   table3600 

but if select cell (potentially within table) can't seem find property either return selected cell's containing table's name. trying either store return value or state current cell not in table.

tia (this seems fundamental yet nowhere)

these return name of table of selected cell. if there no table run-time error thrown.

selection.listobject.name selection.listobject.displayname 

you can avoid error using:

if not selection.listobject nothing     msgbox selection.listobject.name end if 

?activesheet.listobjects(2) give name of second table on sheet , throw error if there no second table.


Comments

Popular posts from this blog

javascript - Why Selenium can't find an element that is graphically visible -

java - How to compare two classes -

mysql - Gateway Timeout Error on Insert 70000 record using Hibernate in Java -