如何在Excel vba中引用表? [英] How do I reference tables in Excel vba?

查看:842
本文介绍了如何在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

这篇关于如何在Excel vba中引用表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆