Guest User

Untitled

a guest
Jan 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. Private Sub BTN_GRAVAR_Click()
  2.  
  3. Dim NR As Long
  4. Dim DATA_MATRICULA As Date
  5. Dim DATA_INICIAL As Date
  6. Dim DATA_FINAL As Date
  7.  
  8.  
  9.  
  10. Folha2.Select
  11.  
  12. Range("A3").End(xlDown).Select
  13.  
  14. NR = ActiveCell.Row
  15.  
  16. Range("a65536").End(xlUp).Offset(1, 0).Select
  17. ActiveCell.Offset(0, 0).Value = LBL_NR.Caption
  18. ActiveCell.Offset(0, 1).Value = txtident.Text
  19. ActiveCell.Offset(0, 2).Value = txtmatricula.Text
  20. ActiveCell.Offset(0, 3).Value = txtdata.Text
  21. ActiveCell.Offset(0, 4).Value = txtcilindrada.Text
  22. ActiveCell.Offset(0, 5).Value = txtpeso.Text
  23. ActiveCell.Offset(0, 6).Value = Cbocombustivel.Text
  24. ActiveCell.Offset(0, 7).Value = cbolugares.Text
  25. ActiveCell.Offset(0, 8).Value = cbotipo.Text
  26. ActiveCell.Offset(0, 9).Value = cbocategoria.Text
  27. ActiveCell.Offset(0, 10).Value = txtpneuf.Text
  28. ActiveCell.Offset(0, 11).Value = txtpneut.Text
  29. ActiveCell.Offset(0, 12).Value = cboseguradora.Text
  30. ActiveCell.Offset(0, 13).Value = txtapolice.Text
  31. ActiveCell.Offset(0, 14).Value = txtvalorizacao.Text
  32. ActiveCell.Offset(0, 15).Value = txtinicial.Text
  33. ActiveCell.Offset(0, 16).Value = txtfinal.Text
  34. ActiveCell.Offset(0, 17).Value = Txtvalor.Text
  35. ActiveCell.Offset(0, 18).Value = txttaxa.Text
  36. ActiveCell.Offset(0, 19).Value = cbocentro.Text
  37.  
  38.  
  39.  
  40.  
  41. Columns("A:T").AutoFit
  42.  
  43.  
  44.  
  45. txtident.Text = ""
  46. txtmatricula.Text = ""
  47. txtdata.Text = ""
  48. txtcilindrada.Text = ""
  49. txtpeso.Text = ""
  50. Cbocombustivel.Value = ""
  51. cbolugares.Value = ""
  52. cbotipo.Value = ""
  53. cbocategoria.Value = ""
  54. txtpneuf.Text = ""
  55. txtpneut.Text = ""
  56. cboseguradora.Value = ""
  57. txtapolice.Text = ""
  58. txtvalorizacao.Text = ""
  59. txtinicial.Text = ""
  60. txtfinal.Text = ""
  61. Txtvalor.Text = ""
  62. txttaxa.Text = ""
  63. cbocentro.Value = ""
  64.  
  65.  
  66. Me.LBL_NR = Folha2.Range("a65536").End(xlUp).Row - 1
  67.  
  68. txtident.SetFocus
  69.  
  70.  
  71. End Sub
  72. Private Sub BTN_Sair_Click()
  73.  
  74. Unload Me
  75.  
  76. End Sub
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. Private Sub txtdata_Change()
  85. If Len(Me.txtdata.Text) = 2 Then
  86. Me.txtdata.Text = Me.txtdata.Text & "/"
  87. Me.txtdata.SelStart = 4
  88. ElseIf Len(Me.txtdata.Text) = 5 Then
  89. Me.txtdata.Text = Me.txtdata.Text & "/"
  90. Me.txtdata.SelStart = 7
  91. ElseIf Len(Me.txtdata.Text) = 10 Then
  92. Me.txtcilindrada.SetFocus
  93. End If
  94.  
  95.  
  96. End Sub
  97.  
  98. Private Sub txtinicial_Change()
  99.  
  100. If Len(Me.txtinicial.Text) = 2 Then
  101. Me.txtinicial.Text = Me.txtinicial.Text & "/"
  102. Me.txtinicial.SelStart = 4
  103. ElseIf Len(Me.txtinicial.Text) = 5 Then
  104. Me.txtinicial.Text = Me.txtinicial.Text & "/"
  105. Me.txtinicial.SelStart = 7
  106. ElseIf Len(Me.txtinicial.Text) = 10 Then
  107. Me.txtfinal.SetFocus
  108. End If
  109. End Sub
  110.  
  111. Private Sub txtfinal_Change()
  112. If Len(Me.txtfinal.Text) = 2 Then
  113. Me.txtfinal.Text = Me.txtfinal.Text & "/"
  114. Me.txtfinal.SelStart = 4
  115. ElseIf Len(Me.txtfinal.Text) = 5 Then
  116. Me.txtfinal.Text = Me.txtfinal.Text & "/"
  117. Me.txtfinal.SelStart = 7
  118. ElseIf Len(Me.txtfinal.Text) = 10 Then
  119. Me.Txtvalor.SetFocus
  120. End If
  121. End Sub
  122.  
  123.  
  124.  
  125. Private Sub txtmatricula_Change()
  126.  
  127. If Len(Me.txtmatricula.Text) = 2 Then
  128. Me.txtmatricula.Text = Me.txtmatricula.Text & "-"
  129. Me.txtmatricula.SelStart = 4
  130. ElseIf Len(Me.txtmatricula.Text) = 5 Then
  131. Me.txtmatricula.Text = Me.txtmatricula.Text & "-"
  132. Me.txtmatricula.SelStart = 8
  133. ElseIf Len(Me.txtmatricula.Text) = 8 Then
  134. Me.txtdata.SetFocus
  135. End If
  136. End Sub
  137.  
  138.  
  139.  
  140. Private Sub UserForm_Initialize()
  141.  
  142. Me.LBL_NR = Folha2.Range("a65536").End(xlUp).Row
  143.  
  144. End Sub
Add Comment
Please, Sign In to add comment