The following code is working fine except it does not copy the Listbox data to the first row of the table. Instead, it copes to the second row of the table. What may be the reason for this?
Code: Select all
Private Sub cmdEnter_Click()
Dim ProjectsTable As ListObject
Dim LastRow As Range
Sheets("Projects Data").ListObjects("Projects").ListRows.Add
Set ProjectsTable = Sheets("Projects Data").ListObjects("Projects")
Set LastRow = ProjectsTable.ListRows(ProjectsTable.ListRows.Count).Range
LastRow.Resize(ListBox1.ListCount, ListBox1.ColumnCount).Value = ListBox1.List
End Sub