Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. Private Sub CommandButton1_Click()
  2.  
  3. Columns("F:G").NumberFormat = "0000000000"
  4. Columns("H").NumberFormat = "000000000"
  5.  
  6. Cells(1, 1) = "Voornaam: "
  7. Cells(1, 2) = "Achternaam: "
  8. Cells(1, 3) = "Straat: "
  9. Cells(1, 4) = "Huisnummer: "
  10. Cells(1, 5) = "Postcode: "
  11. Cells(1, 6) = "Telefoonnummer, vast: "
  12. Cells(1, 7) = "Telefoonnummer, mobiel: "
  13. Cells(1, 8) = "BSN-nummer: "
  14. Cells(1, 9) = "Geboortedatum: "
  15. Columns("A:I").AutoFit
  16. Dim Info(1 To 9) As String
  17. Dim InfoError(1 To 6) As Boolean
  18. Dim Wrong As Boolean
  19. Dim X As Integer
  20. Dim c As Boolean
  21. Dim g As Boolean
  22. Dim h As Integer
  23. Dim i As Integer
  24.  
  25. If TxtNaam.Value = "test" Then
  26. TxtAchternaam.Value = "van der Achternaam de Test"
  27. TxtStraat.Value = "Straat"
  28. TxtHuis.Value = "111"
  29. TxtPost.Value = "1111TT"
  30. TxtVast.Value = "0151111111"
  31. TxtMobiel.Value = "0611111111"
  32. TxtBSN.Value = "111111111"
  33. TxtGeboorte.Value = "01/01/2019"
  34. End If
  35.  
  36. 'Voornaam
  37. Info(1) = TxtNaam.Value
  38. Info(1) = UCase(Left(Info(1), 1)) & Right(Info(1), Len(Info(1)) - 1)
  39.  
  40. 'Achternaam
  41. Info(2) = TxtAchternaam.Value
  42. h = 1
  43. c = False
  44. Do While c = False
  45. If Not Mid(Info(2), h, 1) = LCase(Mid(Info(2), h, 1)) Then
  46. c = True
  47. Else
  48. h = h + 1
  49. If h > Len(Info(2)) Then
  50. Wrong = True
  51. TxtAchternaam.Value = ""
  52. MsgBox ("Gebruik A.U.B. hoofdletters bij achternamen")
  53. h = 1
  54. c = True
  55. End If
  56. End If
  57. Loop
  58.  
  59. If h > 2 Then
  60. Info(2) = Right(Info(2), Len(Info(2)) - h + 1) & ", " & Left(Info(2), h - 2)
  61. End If
  62.  
  63. 'Straat
  64. Info(3) = TxtStraat.Value
  65.  
  66. 'Huisnummer
  67. If IsNumeric(TxtHuis.Value) = True Then
  68. Info(4) = TxtHuis.Value
  69. Else
  70. Wrong = True
  71. TxtHuis.Value = ""
  72. MsgBox ("Gebruik A.U.B. cijfers voor bij huisnummers")
  73. End If
  74.  
  75. 'Postcode
  76. If IsNumeric(Left(TxtPost.Value, 4)) And IsNumeric(Right(TxtPost.Value, 2)) = False Then
  77. Info(5) = TxtPost.Value
  78. Info(5) = Left(TxtPost.Value, 4) & " " & UCase(Right(TxtPost.Value, 2))
  79. Else
  80. Wrong = True
  81. TxtPost.Value = ""
  82. MsgBox ("Voer A.U.B. uw postcode in als vier getallen en twee letters, bijv. '1111AA'")
  83. End If
  84.  
  85. 'Telefoonnummer, vast
  86. If IsNumeric(TxtVast.Value) And Len(TxtVast.Value) = 10 Then
  87. Info(6) = TxtVast.Text
  88. Else
  89. Wrong = True
  90. TxtVast.Value = ""
  91. MsgBox ("aSD")
  92. End If
  93.  
  94. 'Telefoonnummer, mobiel
  95. If IsNumeric(TxtMobiel.Value) And Len(TxtMobiel.Value) = 10 Then
  96. Info(7) = TxtMobiel.Text
  97. Else
  98. Wrong = True
  99. TxtMobiel.Value = ""
  100. End If
  101.  
  102. 'BSN-nummer
  103. If IsNumeric(TxtBSN.Value) And Len(TxtBSN.Value) = 9 Then
  104. Info(8) = TxtBSN.Text
  105. Else
  106. Wrong = True
  107. TxtBSN.Value = ""
  108. End If
  109.  
  110. 'Gebooortedatum
  111. 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
  112. Info(9) = TxtGeboorte.Value
  113. Else
  114. Wrong = True
  115. TxtGeboorte.Value = ""
  116. End If
  117.  
  118. If Not Wrong Then
  119. TxtNaam.Value = ""
  120. TxtAchternaam.Value = ""
  121. TxtStraat.Value = ""
  122. TxtHuis.Value = ""
  123. TxtPost.Value = ""
  124. TxtVast.Value = ""
  125. TxtMobiel.Value = ""
  126. TxtBSN.Value = ""
  127. TxtGeboorte.Value = ""
  128.  
  129. g = True
  130. h = 1
  131. Do While g = True
  132. If Not Cells(h, 1) = "" Then
  133. h = h + 1
  134. Else
  135. X = h
  136. g = False
  137. End If
  138. Loop
  139.  
  140. For i = 1 To 9
  141. Cells(X, i) = Info(i)
  142. Next i
  143. End If
  144.  
  145. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement