The only code I can find for creating tables is something like this:
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$B$1:$D$16"), , xlYes).Name = "Table1"
This converts cells from B1 to D16 into a table.
Let's say I have different values from different cells: A1=2, A2=3, A3=1, A4=4. There's a command button in the worksheet.
I click the command button to create a table with the number of columns equal to the added up values of the above cells (Total is 10). How do I do it?
And let's say I declare a few variables: num1=1, num2=2, num3=3, num4=4. I want to create an equal number of rows or columns in a table to the total value of the variables above (Or individual variable value only such as num1) above. Could it be written?
In short, can someone give me examples on how to create tables with varying numbers of columns and rows?
Bookmarks