Private Sub cmdSend_Click()
On Error Resume Next
If IsNumeric(txtVoornaam.Text) = False Then
MsgBox "Je moet hier cijfers invullen", vbExclamation, "Eerste invoer moet een getal zijn!"
Exit Sub
End If
If Me.txtLastName.Value = "" Then
MsgBox "Vul je voornaam in.", vbExclamation, "Informatie"
Me.txtVoornaam.SetFocus
Exit Sub
End If
If Me.txtMobiel.Value = "" Then
MsgBox "Vul je achternaam in.", vbExclamation, "Informatie"
Me.txtVoornaam.SetFocus
Exit Sub
Else
If Range("A2").Value = ("") Then 'Tot aan Else is enkel om geen foutmelding te krijgen als de rij nog leeg is...
Range("A1").Select 'de offset gaat naar deze kolom
On Error Resume Next
Range("A2").Value = txtVoornaam.Text
Range("b2").Value = txtLastName.Text
Range("c2").Value = txtMobiel.Text
ActiveCell.End(xlDown).Offset(1, 0).Select
txtVoornaam.Text = ""
txtLastName.Text = ""
txtMobiel.Value = ""
Else
On Error Resume Next
If IsNumeric(txtVoornaam.Text) = False Then
MsgBox "Je moet hier cijfers invullen", vbExclamation, "Eerste invoer moet een getal zijn!"
Exit Sub
End If
If Me.txtLastName.Value = "" Then
MsgBox "Vul je voornaam in.", vbExclamation, "Informatie"
Me.txtVoornaam.SetFocus
Exit Sub
End If
If Me.txtMobiel.Value = "" Then
MsgBox "Vul je achternaam in.", vbExclamation, "Informatie"
Me.txtVoornaam.SetFocus
Exit Sub
Else
Range("A1").Select
ActiveCell.End(xlDown).Select
laatste = ActiveCell.Row
'MsgBox laatste
Cells(laatste + 1, 1).Value = txtVoornaam.Text
Cells(laatste + 1, 2).Value = txtLastName.Text
Cells(laatste + 1, 3).Value = txtMobiel.Text
ActiveCell.End(xlDown).Offset(1, 0).Select
txtVoornaam.Text = ""
txtLastName.Text = ""
txtMobiel.Value = ""
End If
End If
End If
End Sub