' ===== Paste into the UserForm's code window ===== Private Sub UserForm_Initialize() txtDate.Value = Format(Date, "dd-mm-yyyy") cboCustomer.List = ThisWorkbook.Sheets("Lists").Range("A2:A5").Value cboProduct.List = ThisWorkbook.Sheets("Lists").Range("B2:B5").Value End Sub Private Sub cmdSave_Click() ' --- validate before writing anything --- If Not IsDate(txtDate.Value) Then MsgBox "Enter a valid date": txtDate.SetFocus: Exit Sub If cboCustomer.ListIndex = -1 Then MsgBox "Pick a customer from the list": Exit Sub If cboProduct.ListIndex = -1 Then MsgBox "Pick a product from the list": Exit Sub If Not IsNumeric(txtQty.Value) Or Val(txtQty.Value) <= 0 Then MsgBox "Qty must be a positive number": Exit Sub If Not IsNumeric(txtAmount.Value) Then MsgBox "Amount must be a number": Exit Sub Dim r As ListRow Set r = ThisWorkbook.Sheets("Entries").ListObjects("tblEntries").ListRows.Add r.Range.Value = Array(CDate(txtDate.Value), cboCustomer.Value, cboProduct.Value, _ CLng(txtQty.Value), CDbl(txtAmount.Value), Environ("USERNAME")) txtQty.Value = "": txtAmount.Value = "": cboProduct.ListIndex = -1 cboProduct.SetFocus End Sub ' ===== Paste into a normal Module ===== Sub ShowForm() UserForm1.Show End Sub