如何在Excel vba中引用表?
问题描述:
可以在Excel VBA中引用一个命名表吗?
Is it possible in Excel VBA to reference a named table?
假设这可能是...
Sheets("Sheet1").Table("A_Table").Select
我看到一些提到表是一个列表对象,但我不知道这是否是同样的事情...
I have seen some mention of tables being a list object but I'm not sure if that is the same thing...
任何人都可以帮助我?
答
也许这可以帮助你
创建一个表
将范围转换为表起始于与Excel 2003中相同的代码(如此答案所述):
Converting a range to a table starts with the same code as in Excel 2003 (as described in this answer):
Sub CreateTable()
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$B$1:$D$16"), , xlYes).Name = _
"Table1"
'No go in 2003
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleLight2"
End Sub