ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Table Name (https://www.excelbanter.com/excel-programming/441359-table-name.html)

Mike H.

Table Name
 
How do I get the name of the current table? I am talking about when I use
the HomeFormat as Table (In the Styles section) and then format data as a
table. Typically Excel assigns the name Table1, Table2, etc. How can I
determine the table name in VBA?

Heera Chavan[_2_]

Table Name
 
here you go
ActiveSheet.ListObjects.Add(xlSrcRange,
Range(ActiveCell.CurrentRegion.Address), , xlYes).Name = "ABCD1"

But the only catch over here is your cursor should be with in the table.
I mean if you have data in range "A1:E40", then your cursor should be with
in this range. If the cursor is in cell F3 then this code will work but not
as you want it to.

regards
Heera Chavan

"Mike H." wrote:

How do I get the name of the current table? I am talking about when I use
the HomeFormat as Table (In the Styles section) and then format data as a
table. Typically Excel assigns the name Table1, Table2, etc. How can I
determine the table name in VBA?



All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com