Hi I'm having some difficulty with an excel vba form I've created. I load the form from a the first set of code which I've placed in a module, nice and simple works. Then I enter the data and on clicking a command button I need to load the data from the form into a table.
So if I test the form from running my Sub CommandButtonCreate_Click() from within the userform vba it all works fine. However if I Run the DataForm Macro to load the form from within the spreadsheet and then click on the command button only the non userform data ( newrow.Range(1) & (2)) loads into the table, nothing form the Combo or text boxes. I'm sure there's something obvious I've gotten wrong here, pointers gratefully recieved!
So if I test the form from running my Sub CommandButtonCreate_Click() from within the userform vba it all works fine. However if I Run the DataForm Macro to load the form from within the spreadsheet and then click on the command button only the non userform data ( newrow.Range(1) & (2)) loads into the table, nothing form the Combo or text boxes. I'm sure there's something obvious I've gotten wrong here, pointers gratefully recieved!
VBA Code:
Sub DataForm()
Dim frm As UserForm1
Set frm = New UserForm1
frm.Show
End Sub
VBA Code:
Sub CommandButtonCreate_Click()
Dim ws As Worksheet
Dim tbl As ListObject
Dim newrow As ListRow
Dim x As Long
Set ws = Data
Set tbl = ws.ListObjects("Dossier")
Set newrow = tbl.ListRows.Add
x = tbl.Range.Rows.Count
'update list
newrow.Range(1).Value = "Textbox " & x - 1
newrow.Range(2).Value = x - 1
newrow.Range(3).Value = UserForm1.ComboBoxTeam.Value
newrow.Range(4).Value = UserForm1.TextBoxDescription.Text
newrow.Range(5).Value = UserForm1.ComboBoxType.Text
newrow.Range(6).Value = UserForm1.ComboBoxRAG.Text
End Sub