I am a beginner when it comes to VBA. I want to create as many dynamic table as a given value X. The tables should be created one near the other. Each row of the table should have at least a cell with text and a formula. This is what I have done already:

Private Sub CommandButton1_Click()

Dim t As ListObject

Dim c As Range


Sheet4.Activate

Set t = Sheet4.ListObjects.Add(xlSrcRange, Sheet4.Range("A2").Resize(37, 5), , xlNo)

t.ListColumns(1).Name = "Samples"

t.ListColumns(2).Name = "Activities"

t.ListColumns(3).Name = "Discipline"

t.ListColumns(4).Name = "Activity"

t.ListColumns(5).Name = "Duration(h)"

End Sub

I don't know how can I make the loop to put the tables on columns, not rows and how to add names and formulas in the table rows dynamically.