Una familia de software de hoja de cálculo de Microsoft con herramientas para analizar, trazar y comunicar datos.
hola de nuevo
os dejo el código del modulo y el de modicar cambios desde el formulario
modulo
Option Explicit
Sub registrar()
Load frm_Tags
Sheets("Tags").Activate
frm_Tags.Show
End Sub
Function nCliente(nombre As String) As Integer
Application.ScreenUpdating = False
Sheets("Tags").Activate
Range("A2").Activate
nCliente = 0
Do While Not IsEmpty(ActiveCell)
If nombre = ActiveCell Then
nCliente = ActiveCell.Row
End If
ActiveCell.Offset(1, 0).Select
Loop
Application.ScreenUpdating = True
End Function
botón de modificar desde el formulario
Private Sub cmd_Agregar_Click()
Dim i As Integer
If cbo_Nombre.Text = "" Then
MsgBox "Nombre inválido", vbInformation + vbOKOnly
cbo_Nombre.SetFocus
Exit Sub
End If
If Not (Mid(cbo_Nombre.Text, 1, 1) Like "[a-z]" Or Mid(cbo_Nombre.Text, 1, 1) Like "[A-Z]") Then
MsgBox "Nombre inválido", vbInformation + vbOKOnly
cbo_Nombre.SetFocus
Exit Sub
End If
For i = 2 To Len(cbo_Nombre.Text)
If Mid(cbo_Nombre.Text, i, 1) Like "" Then
MsgBox "Nombre inválido", vbInformation + vbOKOnly
cbo_Nombre.SetFocus
Exit Sub
End If
Next
Sheets("Tags").Activate
Dim fCliente As Integer
fCliente = nCliente(cbo_Nombre.Text)
If fCliente = 0 Then
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate ' si el registro no existe, se va al final.
Loop
Else
Cells(fCliente, 1).Select ' cuando ya existe el registro, cumple esta condición.
End If
'Aqui es cuando agregamos o modificamos el registro
Application.ScreenUpdating = False
ActiveCell = cbo_Nombre
ActiveCell.Offset(0, 1) = cbo_circuito
ActiveCell.Offset(0, 2) = txt_equipo
ActiveCell.Offset(0, 3) = txt_descripción
ActiveCell.Offset(0, 4) = cbo_situacion
ActiveCell.Offset(0, 5) = txt_caracteristicas
ActiveCell.Offset(0, 6) = txt_sdt
ActiveCell.Offset(0, 7) = Now
ActiveCell.Offset(0, 8) = txt_comentario
ActiveCell.Offset(0, 9) = cbo_estado
Sheets("Tags").Activate
Application.ScreenUpdating = True
LimpiarFormulario
cbo_Nombre.SetFocus
End Sub
este formulario me lo descargue y lo modifique a lo que yo necesitaba (ya os dije que llevo muy poco con esto y no comprendo muchas cosas, voy poco a poco)
gracias