Hi New to all this and having trouble writing a code to set a list row in a table from value in textbox.
The idea is so I can edit rows without creating a new row all data being written to a table.
Any help would be great thank you.
Sub Submit1()
'ADD RECORD TO DATABASE 1
Dim database1 As Worksheet
Dim table_list_object As ListObject
Dim iRow As ListRow
Set database1 = Sheets("database1")
Set table_list_object = database1.ListObjects(1)
If Form1.txtRowNumber1.Value = "" Then
Set iRow = table_list_object.ListRows.Add
Else
Set iRow = Form1.txtRowNumber1.Value
End If
iRow.Range(1, 1).Value = "=Row()-1" 'Dynamic Serial Number
iRow.Range(1, 2).Value = Form1.cmbCompany.Value
End Sub
Bookmarks