Solved Data Entry Without Userform (1 Viewer)

Rania01

Member
Local time
Today, 22:41
Joined
Oct 9, 2021
Messages
59
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

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
 

June7

AWF VIP
Local time
Today, 12:41
Joined
Mar 9, 2014
Messages
5,473
Help you with what? What is the issue?

Why use Excel as a database?
 

Rania01

Member
Local time
Today, 22:41
Joined
Oct 9, 2021
Messages
59
Example :

If I Select on cell C14:H14 the data on this cell will appear in the form see photos

Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:41
Joined
May 7, 2009
Messages
19,245
here check and see the code.
 

Attachments

  • Data Entry.zip
    33.5 KB · Views: 112

Users who are viewing this thread

Top Bottom