Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Dim rpta As Integer
  2.  
  3. Dim j1 As Integer
  4. Dim k1 As Integer
  5. Dim i1 As Integer
  6. Dim cadena As String
  7.  
  8. j1 = ActiveCell.Offset(1, 0) 'fila 4
  9. k1 = ActiveCell.Offset(0, 1) 'columna D
  10.  
  11. rpta = MsgBox("¿Desea registrar estos datos?", vbYesNo)
  12. If rpta = vbNo Then Exit Sub
  13.  
  14. Range("A2").Select
  15. While ActiveCell <> ""
  16. ActiveCell.Offset(1, 0).Select
  17. If ActiveCell = Val(Txtn) Then
  18. rpta = MsgBox(" El postulante ya esta registrado, ¿Desea actualizar su informacion?", vbYesNo)
  19. If rpta = vbNo Then Exit Sub
  20. GoTo Sale
  21. End If
  22. Wend
  23. Sale:
  24. ActiveCell = Val(Txtn)
  25. ActiveCell.Offset(0, 1) = cboregimen
  26. ActiveCell.Offset(0, 2) = CDate(txtfecha)
  27. ActiveCell.Offset(0, 3) = cbounidad
  28. ActiveCell.Offset(0, 4) = UCase(txtcol)
  29.  
  30. For i1 = 1 To Len(txtcol)
  31.  
  32. If Mid(txtcol.Value, i1, 1) <> Chr(13) Then
  33. If Mid(txtcol.Value, i1, 1) <> Chr(10) Then
  34. cadena = cadena & Mid(txtcol.Value, i1, 1)
  35. End If
  36. Else
  37. Cells(j1, k1) = cadena
  38. j1 = j1 + 1 'para incrementar filas
  39. 'k = k + 1 'para incrementar columnas
  40. cadena = ""
  41. End If
  42. Next
  43. Cells(j1, k1) = cadena
  44.  
  45. ActiveCell.Offset(0, 5) = txtdni
  46. ActiveCell.Offset(0, 6) = cbocargo
  47. ActiveCell.Offset(0, 7) = txtjornal
  48. ActiveCell.Offset(0, 8) = cbotact
  49.  
  50. On Error Resume Next
  51. Application.ScreenUpdating = False
  52.  
  53. End Sub
Add Comment
Please, Sign In to add comment