Table Name

  • Thread starter Thread starter Mike H.
  • Start date Start date
M

Mike H.

How do I get the name of the current table? I am talking about when I use
the Home>Format 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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top