Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Private Sub btnEnviar_Click()
  2. Dim iFile As Long
  3.  
  4. Dim ws As Worksheet
  5. Set ws = Worksheets(1)
  6.  
  7. iFile = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
  8.  
  9. If Trim(Me.txtNombre.Value) = "" Then
  10. Me.txtNombre.SetFocus
  11. MsgBox "Debe agregar un nombre"
  12. Exit Sub
  13. End If
  14.  
  15. If Trim(Me.txtEmail.Value) = "" Then
  16. Me.txtEmail.SetFocus
  17. MsgBox "Debe agregar un email"
  18. Exit Sub
  19. End If
  20.  
  21. ws.Cells(iFile, 1).Value = Me.txtNombre.Value
  22. ws.Cells(iFile, 2).Value = Me.txtEmpresa.Value
  23. ws.Cells(iFile, 3).Value = Me.txtEmail.Value
  24. ws.Cells(iFile, 4).Value = Me.txtTelefono.Value
  25. ws.Cells(iFile, 5).Value = Me.txtPoblacion.Value
  26. ws.Cells(iFile, 6).Value = Me.cbPais.Value
  27. ws.Cells(iFile, 7).Value = Me.txtMensaje.Value
  28.  
  29. Me.txtNombre = ""
  30. Me.txtEmpresa = ""
  31. Me.txtEmail = ""
  32. Me.txtTelefono = ""
  33. Me.txtPoblacion = ""
  34. Me.cbPais = ""
  35. Me.txtMensaje = ""
  36. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement