使用字符串变量命名listobject

时间:2015-11-03 20:35:05

标签: object listobject

Sub ShowHideTable()
    Dim table As ListObject
    Dim tblTrngl As Shape
    Dim tblName As String

Call Shape_Clicked(tblTrngl)
Let tblName = tblTrngl.Name
tblName = Replace(tblName, "Trngl", "")
Let table.Name = tblName

我已对其进行了调试,tblName正是我想要的,但当我尝试设置listobject的名称时,我收到了错误消息。 无论我如何设置它,最后一行都会出错。我做错了什么?

1 个答案:

答案 0 :(得分:0)

Set table = ThisWorkbook.ActiveSheet.ListObjects(tblName)