Hi there,
I have a worksheet whose data change periodically leading to larger or smaller ranges of columns being used depending on the data. The number of rows are always the same.
In my VBA module that gets the data, I would like to make a table (instead of cntl-T afterwards) with the data each time I grab it and always have the same table name.
I've tried a few things including this below which will only make a table of the A column.
I tried using ActiveSheet.UsedRange.Select assigned to a Range variable, but that didn't work.
Since my data table changes size I can't use a pre-defined range in the column direction so I'm not sure how to make it expand or shrink to "wrap" columns for making it into a table. I tried counting columns, converting the max to a letter and then putting it in, but Is there a way to do this without having to count columns and pass that to the second part of the range below?
Thank you!
I have a worksheet whose data change periodically leading to larger or smaller ranges of columns being used depending on the data. The number of rows are always the same.
In my VBA module that gets the data, I would like to make a table (instead of cntl-T afterwards) with the data each time I grab it and always have the same table name.
I've tried a few things including this below which will only make a table of the A column.
I tried using ActiveSheet.UsedRange.Select assigned to a Range variable, but that didn't work.
Since my data table changes size I can't use a pre-defined range in the column direction so I'm not sure how to make it expand or shrink to "wrap" columns for making it into a table. I tried counting columns, converting the max to a letter and then putting it in, but Is there a way to do this without having to count columns and pass that to the second part of the range below?
Thank you!
VBA Code:
Worksheets("BaseData").Activate
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:A" & 1259), , xlYes).Name = _
"BaseDataTable"
Range("Table1[#All]").Select