Private Sub CommandButton2_Click() 'Siguiente
Set h3 = Sheets("temporal")
If h3.Cells(1, "A") = "" Then
h3.Cells.Clear
hojas = Array("ROTATIVOS", "PLANOS")
For i = LBound(hojas) To UBound(hojas)
Set h = Sheets(hojas(i))
Set r = h.Columns("B")
Set b = r.Find(TextBox1, lookat:=xlWhole)
If Not b Is Nothing Then
ncell = b.Address
Do
j = j + 1
h3.Cells(j, "A") = h.Name
h3.Cells(j, "B") = b.Row
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> ncell
End If
Next
If j > 0 Then
CommandButton2_Click
Else
MsgBox "CÓDIGO NO ENCONTRADO"
End If
TextBox1.SetFocus
Else
u = h3.Range("C" & Rows.Count).End(xlUp).Row
If u = 1 Then
If h3.Cells(u, "C") = "x" Then
u = 2
End If
Else
u = u + 1
End If
If h3.Cells(u, "A") = "" Then
MsgBox "Ya no hay más coincidencias", vbExclamation, "BUSCAR"
Else
h3.Cells(u, "C") = "x"
h = h3.Cells(u, "A")
f = h3.Cells(u, "B")
ponertextbox h, f
End If
End If
End Sub
Private Sub CommandButton10_Click() 'Anterior
Set h3 = Sheets("temporal")
u = h3.Range("C" & Rows.Count).End(xlUp).Row
h3.Cells(u, "C") = ""
u = h3.Range("C" & Rows.Count).End(xlUp).Row
If u = 1 And h3.Cells(u, "C") = "" Then
MsgBox "Inicio", vbExclamation, "BUSCAR"
h3.Cells(1, "C") = "x"
Else
h = h3.Cells(u, "A")
f = h3.Cells(u, "B")
ponertextbox h, f
End If
End Sub
Private Sub CommandButton2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
CommandButton2_Click
End Sub
Private Sub CommandButton10_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
CommandButton10_Click
End Sub
Private Sub CommandButton9_Click()
Unload Me
End Sub
Sub ponertextbox(h, f)
TextBox2 = Sheets(h).Range("C" & f).Value
TextBox3 = Sheets(h).Range("E" & f).Value
TextBox4 = Sheets(h).Range("D" & f).Value
TextBox5 = Sheets(h).Range("H" & f).Value
TextBox6 = Sheets(h).Range("F" & f).Value
TextBox7 = Sheets(h).Range("G" & f).Value
TextBox8 = Sheets(h).Range("K" & f).Value
TextBox9 = Sheets(h).Range("I" & f).Value
TextBox10 = Sheets(h).Range("J" & f).Value
TextBox11 = Sheets(h).Range("L" & f).Value
TextBox12 = Sheets(h).Range("N" & f).Value
TextBox13 = Sheets(h).Range("O" & f).Value
TextBox14 = Sheets(h).Range("M" & f).Value
TextBox15 = Sheets(h).Range("P" & f).Value
End Sub
Private Sub TextBox1_Change()
Sheets("Temporal").Range("A1") = ""
End Sub