Dear All,
I hope you can help me, I make data entry in the way if I click in the data All data in the cell will appear in the form
I use below VBA to save the data en clear the form
Save Data :
Clear Data :
I hope you can help me, I make data entry in the way if I click in the data All data in the cell will appear in the form
I use below VBA to save the data en clear the form
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ExcelVba
Application.ScreenUpdating = False
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C13:H9999")) Is Nothing And Range("C" & Target.Row).Value <> Empty Then
Range("A5").Value = Target.Row
End If
Exit Sub
ExcelVba:
End Sub
Save Data :
Code:
Sub Opslaan_Gegevens()
If ActiveSheet.TextBox1.Value = "" Then
MsgBox "Voer naam in!"
Exit Sub
End If
If ActiveSheet.TextBox2.Value = "" Then
MsgBox "Voer Leeftijd in!"
Exit Sub
End If
If ActiveSheet.TextBox3.Value = "" Then
MsgBox "Voer Adres in!"
Exit Sub
End If
If ActiveSheet.TextBox4.Value = "" Then
MsgBox "Voer Geslagt in!"
Exit Sub
End If
If ActiveSheet.TextBox5.Value = "" Then
MsgBox "Voer Contact Nr in!"
Exit Sub
End If
If ActiveSheet.TextBox2.Value = "" Then
MsgBox "Voer E-mail in!"
Exit Sub
End If
Sheet1.Range("C2000").End(xlUp).Offset(1, 0).Value = ActiveSheet.TextBox1.Value
Sheet1.Range("C2000").End(xlUp).Offset(0, 1).Value = ActiveSheet.TextBox2.Value
Sheet1.Range("C2000").End(xlUp).Offset(0, 2).Value = ActiveSheet.TextBox3.Value
Sheet1.Range("C2000").End(xlUp).Offset(0, 3).Value = ActiveSheet.TextBox4.Value
Sheet1.Range("C2000").End(xlUp).Offset(0, 4).Value = ActiveSheet.TextBox5.Value
Sheet1.Range("C2000").End(xlUp).Offset(0, 5).Value = ActiveSheet.TextBox6.Value
MsgBox "Met succes opgeslagen!"
Call Clear
End Sub
Clear Data :
Code:
Sub Clear()
With ActiveSheet
.TextBox1.Value = ""
.TextBox2.Value = ""
.TextBox3.Value = ""
.TextBox4.Value = ""
.TextBox5.Value = ""
.TextBox6.Value = ""
End With
End Sub