Code to Select Multiple Columns in an Excel Table

Viewed 20131

I am new to Excel VBA. I need a modification in my code so that I would be able to proceed further.

I want to select multiple table columns in an excel table. Here is my code:

Dim ws As Worksheet
Dim tbl As ListObject

Set ws = Sheets("Sheet1")
Set tbl = ws.ListObjects(1)

Range("tbl[[Column1]:[Column5]]").Select

When I put the table name, it works. but I want to use variable which I have used in my code to select the table columns.

2 Answers
Related