Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- Columns("F:G").NumberFormat = "0000000000"
- Columns("H").NumberFormat = "000000000"
- Cells(1, 1) = "Voornaam: "
- Cells(1, 2) = "Achternaam: "
- Cells(1, 3) = "Straat: "
- Cells(1, 4) = "Huisnummer: "
- Cells(1, 5) = "Postcode: "
- Cells(1, 6) = "Telefoonnummer, vast: "
- Cells(1, 7) = "Telefoonnummer, mobiel: "
- Cells(1, 8) = "BSN-nummer: "
- Cells(1, 9) = "Geboortedatum: "
- Columns("A:I").AutoFit
- Dim Info(1 To 9) As String
- Dim InfoError(1 To 6) As Boolean
- Dim Wrong As Boolean
- Dim X As Integer
- Dim c As Boolean
- Dim g As Boolean
- Dim h As Integer
- Dim i As Integer
- If TxtNaam.Value = "test" Then
- TxtAchternaam.Value = "van der Achternaam de Test"
- TxtStraat.Value = "Straat"
- TxtHuis.Value = "111"
- TxtPost.Value = "1111TT"
- TxtVast.Value = "0151111111"
- TxtMobiel.Value = "0611111111"
- TxtBSN.Value = "111111111"
- TxtGeboorte.Value = "01/01/2019"
- End If
- 'Voornaam
- Info(1) = TxtNaam.Value
- Info(1) = UCase(Left(Info(1), 1)) & Right(Info(1), Len(Info(1)) - 1)
- 'Achternaam
- Info(2) = TxtAchternaam.Value
- h = 1
- c = False
- Do While c = False
- If Not Mid(Info(2), h, 1) = LCase(Mid(Info(2), h, 1)) Then
- c = True
- Else
- h = h + 1
- If h > Len(Info(2)) Then
- Wrong = True
- TxtAchternaam.Value = ""
- MsgBox ("Gebruik A.U.B. hoofdletters bij achternamen")
- h = 1
- c = True
- End If
- End If
- Loop
- If h > 2 Then
- Info(2) = Right(Info(2), Len(Info(2)) - h + 1) & ", " & Left(Info(2), h - 2)
- End If
- 'Straat
- Info(3) = TxtStraat.Value
- 'Huisnummer
- If IsNumeric(TxtHuis.Value) = True Then
- Info(4) = TxtHuis.Value
- Else
- Wrong = True
- TxtHuis.Value = ""
- MsgBox ("Gebruik A.U.B. cijfers voor bij huisnummers")
- End If
- 'Postcode
- If IsNumeric(Left(TxtPost.Value, 4)) And IsNumeric(Right(TxtPost.Value, 2)) = False Then
- Info(5) = TxtPost.Value
- Info(5) = Left(TxtPost.Value, 4) & " " & UCase(Right(TxtPost.Value, 2))
- Else
- Wrong = True
- TxtPost.Value = ""
- MsgBox ("Voer A.U.B. uw postcode in als vier getallen en twee letters, bijv. '1111AA'")
- End If
- 'Telefoonnummer, vast
- If IsNumeric(TxtVast.Value) And Len(TxtVast.Value) = 10 Then
- Info(6) = TxtVast.Text
- Else
- Wrong = True
- TxtVast.Value = ""
- MsgBox ("aSD")
- End If
- 'Telefoonnummer, mobiel
- If IsNumeric(TxtMobiel.Value) And Len(TxtMobiel.Value) = 10 Then
- Info(7) = TxtMobiel.Text
- Else
- Wrong = True
- TxtMobiel.Value = ""
- End If
- 'BSN-nummer
- If IsNumeric(TxtBSN.Value) And Len(TxtBSN.Value) = 9 Then
- Info(8) = TxtBSN.Text
- Else
- Wrong = True
- TxtBSN.Value = ""
- End If
- 'Gebooortedatum
- If IsNumeric(Left(TxtGeboorte.Value, 2)) And IsNumeric(Mid(TxtGeboorte.Value, 4, 2)) And IsNumeric(Right(TxtGeboorte.Value, 4)) And Mid(TxtGeboorte.Value, 3, 1) = "/" And Mid(TxtGeboorte.Value, 6, 1) = "/" And Len(TxtGeboorte.Value) = 10 Then
- Info(9) = TxtGeboorte.Value
- Else
- Wrong = True
- TxtGeboorte.Value = ""
- End If
- If Not Wrong Then
- TxtNaam.Value = ""
- TxtAchternaam.Value = ""
- TxtStraat.Value = ""
- TxtHuis.Value = ""
- TxtPost.Value = ""
- TxtVast.Value = ""
- TxtMobiel.Value = ""
- TxtBSN.Value = ""
- TxtGeboorte.Value = ""
- g = True
- h = 1
- Do While g = True
- If Not Cells(h, 1) = "" Then
- h = h + 1
- Else
- X = h
- g = False
- End If
- Loop
- For i = 1 To 9
- Cells(X, i) = Info(i)
- Next i
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement