I have found a way to do what you have asked. I had to adjust your original code so that the row added was at the end of the table, and I had to decide where the ID column would be. I have included some instruction on how the column can be changed. Additionally, I made the sub in a way that it will check if IDs are present in the first row of the table. This is done so that if no IDs are in the sheet it will operate as intended.
Private Sub CommandButton1_Click()
'@Variable myRow is the row which will be added to the table.
Dim myRow As ListRow
'@Variable modBook is the workbook containing the table to be modified.
'Change this by using a specific workbook if the active book is not the one
'containing the table.
Dim modBook As Workbook
Set modBook = ActiveWorkbook
'@Variable modSht is the sheet containing the table to have a row added to.
'Change this by changing the sheet name.
Dim modSht As Worksheet
Set modSht = modBook.Worksheets("Formations")
'@Variable modTable is the table to be modified. Change this by changing the name of the table.
Dim modTable As ListObject
Set modTable = modSht.ListObjects("formations")
'@Variable intRows is the number of rows in the table with one extra so that the row will be placed
'at the end of the table, and so that the number will be placed into the newest row.
Dim intRows As Integer
intRows = modTable.ListRows.Count + 1
'@Variable IDNum is the ID Number to be put into the new column.
Dim IDNum As Integer
'@Variable IDCol is the column that contains the ID Numbers. Change this by changing "A" to another column.
Dim IDCol As Range
Set IDCol = modSht.Range("A2:A" & intRows)
'Checks if the first cell with an ID Number is not 1. If it is not it adds ID numbers to every row in the table
'then adds the new row and gives it the ID Number next in line.
If IDCol.Cells(2, 1).Value < 1 Then
IDNum = 1
For Each cell In IDCol
cell.Value = IDNum
IDNum = IDNum + 1
Next
Set myRow = modTable.ListRows.Add(intRows)
IDCol.Cells(intRows, 1).Value = IDNum
'If the first cell is 1 or greater then the ID Column contains IDs so the last row in the table will become the new
'ID Number.
Else
IDNum = Cells(intRows, 1).Value + 1
Set myRow = modTable.ListRows.Add(intRows)
modSht.Cells(intRows + 1, 1).Value = IDNum
End If
End Sub
If you have any questions about how it works, please let me know. Hope this helps!
Edited to include changes so that IDs are printed to the "Formations" sheet.