Esha Goradia
Esha Goradia

Reputation: 31

how to declare variable for an excel table using vba

I am trying to declare a variable for my excel table named "Technology Landscape" by entering the below code. Is this correct.

TL = Sheet1.ListObjects("TechnologyLandscape").Range.Table

Any ideas? Thanks..!

Upvotes: 3

Views: 10417

Answers (1)

user4039065
user4039065

Reputation:

A ListObject object is like a range. It needs to be Set.

Dim TL As ListObject
Set TL = Sheet1.ListObjects("TechnologyLandscape")
Debug.Print TL.ListRows.Count

Upvotes: 3

Related Questions