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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -