Disculpad. Se me había olvidado adjuntar el código.
Private Sub ListBox1_Click()
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
If Not ListBox1.ListIndex = -1 Then
With Me.ListBox1
Me.TextBox0 = .List(.ListIndex, 0)
Me.ComboBox3 = .List(.ListIndex, 1)
Me.ComboBox1 = .List(.ListIndex, 2)
Me.ComboBox2 = .List(.ListIndex, 3)
Me.TextBox33 = Format(.List(.ListIndex, 4), "#,##0.00 €")
End With
End If
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Activate()
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
ListBox1.Clear
With ListBox1
For j = 2 To Hoja4.Range("A" & Rows.Count).End(xlUp).Row
.AddItem
.List(.ListCount - 1, 0) = Range("A" & j)
.List(.ListCount - 1, 1) = Range("B" & j)
.List(.ListCount - 1, 2) = Range("C" & j)
.List(.ListCount - 1, 3) = Range("D" & j)
.List(.ListCount - 1, 4) = Format(Range("E" & j), "#,##0.00 €")
Next
End With
ComboBox3.RowSource = "T2:T" & Range("T" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = "U2:U" & Range("U" & Rows.Count).End(xlUp).Row
ComboBox2.RowSource = "V2:V" & Range("V" & Rows.Count).End(xlUp).Row
ListBox1.ListIndex = 0
ListBox1.SetFocus
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton1_Click(): On Error Resume Next
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
Hoja4.Select
If ComboBox3 = "" Or TextBox33 = "" Or ComboBox2 = "" Or ComboBox1 = "" Then
MsgBox " Faltan datos "
Else
Dim fila As Long, Duplicados As Boolean, cuenta As String, ultFila As Long, C As Range
ultFila = Hoja4.Range("A" & Rows.Count).End(xlUp).Row
cuenta = TextBox0.Value
fila = 0
fila = Application.WorksheetFunction.CountA(Range("A:A")) + 1
With Hoja4.Range("A2:A" & ultFila)
Set C = .Find(cuenta, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
fila = C.Row
Hoja4.Cells(fila, 2) = ComboBox3
Hoja4.Cells(fila, 3) = ComboBox1
Hoja4.Cells(fila, 4) = ComboBox2
Hoja4.Cells(fila, 5) = CDbl(TextBox33)
End If
End With
ListBox1.Clear
UserForm_Activate
End If
End Sub