buen dia
tendrás algún correo donde te pueda mandar el archivo completo para que lo puedas ver mejor
Private Sub CommandButton1_Click()
Dim id_noexpediente, idBuscar As String
Dim fila As Integer
fila = 6
id_noexpediente = TextBox14
Do While idBuscar <> id_noexpediente
fila = fila + 1
idBuscar = Range("C" & fila).Value
If idBuscar = Empty Then
MsgBox " No se encontro numero de expediente"
Exit Do
End If
Loop
TextBox1 = Range("B" & fila).Value
TextBox2 = Range("D" & fila).Value
TextBox3 = Range("E" & fila).Value
TextBox4 = Range("F" & fila).Value
TextBox5 = Range("G" & fila).Value
TextBox6 = Range("H" & fila).Value
TextBox7 = Range("I" & fila).Value
TextBox8 = Range("J" & fila).Value
TextBox9 = Range("K" & fila).Value
TextBox10 = Range("L" & fila).Value
TextBox11 = Range("M" & fila).Value
TextBox12 = Range("N" & fila).Value
TextBox14.SetFocus
End Sub
Private Sub CommandButton2_Click()
Dim NombreHoja As String
Dim HojaDestino As Range
Dim NuevaFila As String
NombreHoja = Me.ComboBox1.Value
Set HojaDestino = ThisWorkbook.Sheets(NombreHoja).Range("B6").CurrentRegion
NuevaFila = HojaDestino.Rows.Count + 6
With ThisWorkbook.Sheets(NombreHoja)
.Cells(NuevaFila, 2).Value = Me.TextBox1.Value
.Cells(NuevaFila, 3).Value = Me.TextBox14.Value
.Cells(NuevaFila, 4).Value = Me.TextBox2.Value
.Cells(NuevaFila, 5).Value = Me.TextBox3.Value
.Cells(NuevaFila, 6).Value = Me.TextBox4.Value
.Cells(NuevaFila, 7).Value = Me.TextBox5.Value
.Cells(NuevaFila, 8).Value = Me.TextBox6.Value
.Cells(NuevaFila, 9).Value = Me.TextBox7.Value
.Cells(NuevaFila, 10).Value = Me.TextBox8.Value
.Cells(NuevaFila, 11).Value = Me.TextBox9.Value
.Cells(NuevaFila, 12).Value = Me.TextBox10.Value
.Cells(NuevaFila, 13).Value = Me.TextBox11.Value
.Cells(NuevaFila, 14).Value = Me.TextBox12.Value
.Cells(NuevaFila, 15).Value = Me.TextBox13.Value
.Cells(NuevaFila, 16).Value = Date
.Cells(NuevaFila, 17).Value = Time
.Cells(NuevaFila, 18).Value = Me.TextBox18.Value
.Cells(NuevaFila, 19).Value = Me.TextBox19.Value
.Cells(NuevaFila, 20).Value = Me.TextBox20.Value
.Cells(NuevaFila, 21).Value = Me.TextBox21.Value
End With
MsgBox "Registro exitoso.", vbInformation, "EXCELeINFO"
Unload Me
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub TextBox13_Change()
'Sheets("BD").Select'
'seleccionamos la ceda donde se debe alojar el dato
'Range("N7").Select '
'guardamos el dato en la celda
'ActiveCell.Value = TextBox13.Value'
End Sub
Private Sub UserForm_Initialize()
Dim intHojas As Integer
Dim i As Integer
intHojas = ThisWorkbook.Sheets.Count
For i = 2 To intHojas
Me.ComboBox1.AddItem ThisWorkbook.Sheets(i).Name
Next i
End Sub