Adrianz1001
New Member
- Joined
- Nov 2, 2021
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hello, I am trying to format data as a table in excel using VBA. The hope is that this macro will be used to format data as tables to run PivotTables from; however, the issue is that the tables will all have a different amount of rows. The table columns are fixed, but the rows are variable. Below is my current code. The testing data I am using is on Sheet1 and goes from A1:I265. As an example, I would need this to auto adjust for a table ranging from A1:I300. Any help would be greatly appreciated!
VBA Code:
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$I$265"), , xlYes).Name = "Table1"