I am struggling to find out how to add data to a table. I have the following code:
Dim ws As Worksheet
Set ws = ActiveSheet
Dim tbl As ListObject
Set tbl = ws.ListObjects("Table1")
tbl.ListRows.Add 1
This adds a new row at the top of the table but how do you then add data to the specific columns in that new table row?
Column 1 in the table = Date
Column 2 in the table = Licence 1
Column 3 in the table = Licence 2
Column 4 in the table = Licence 3
I know if I wanted to add a new row to the bottom of the table then I would use this:
Dim ws As Worksheet
Set ws = ActiveSheet
Dim tbl As ListObject
Set tbl = ws.ListObjects("Table1")
Set NewRow = tbl.ListRows.Add
With NewRow
.Range(1) = date
.Range(2) = 378
.Range(3) = 678
.Range(4) = 897
End With
But cannot not get it to work for a specific row on the table
Thanks