Te anexo la macro para filtrar en la hoja1 y pasar a la hoja2
Private Sub CommandButton1_Click()
'Por.Dante Amor
Application.ScreenUpdating = False
Set h1 = Sheets("Hoja1")
Set h2 = Sheets("Hoja2")
h2.Rows("5:" & Rows.Count).ClearContents
'validaciones
If ComboBox1.Value = "" Or ComboBox1.ListIndex = -1 Then
MsgBox "Selecciona un operador"
ComboBox1.SetFocus
Exit Sub
Else
Select Case ComboBox1.ListIndex
Case 0: op1 = ">"
Case 1: op1 = "<"
Case 2: op1 = ">="
Case 3: op1 = "<="
End Select
End If
If TextBox1.Value = "" Or Not IsNumeric(TextBox1.Value) Then
MsgBox "captura un valor"
TextBox1.SetFocus
Exit Sub
End If
'
cond = ""
If ComboBox2.Value = "" Or ComboBox2.ListIndex = -1 Then
If TextBox2 <> "" Then
MsgBox "Selecciona un operador"
ComboBox2.SetFocus
Exit Sub
End If
Else
If TextBox2 = "" Or Not IsNumeric(TextBox2.Value) Then
MsgBox "captura un valor"
TextBox2.SetFocus
Exit Sub
Else
If OptionButton1 = False And OptionButton2 = False Then
MsgBox "Selecciona una condicional"
OptionButton1.SetFocus
Exit Sub
Else
If OptionButton1 Then
cond = xlAnd
End If
If OptionButton2 Then
cond = xlOr
End If
Select Case ComboBox2.ListIndex
Case 0: op2 = ">"
Case 1: op2 = "<"
Case 2: op2 = ">="
Case 3: op2 = "<="
End Select
End If
End If
End If
'
'Filtrado
If h1.AutoFilterMode Then h1.AutoFilterMode = False
u1 = h1.Range("B" & Rows.Count).End(xlUp).Row
If cond = "" Then
h1.Range("A1:J" & u1).AutoFilter Field:=10, _
Criteria1:=op1 & Val(TextBox1.Value)
Else
h1.Range("A1:J" & u1).AutoFilter Field:=10, _
Criteria1:=op1 & Val(TextBox1.Value), _
Operator:=cond, _
Criteria2:=op2 & Val(TextBox2.Value)
End If
'
u1 = h1.Range("B" & Rows.Count).End(xlUp).Row
If u1 = 1 Then
MsgBox "No hay registros"
Exit Sub
End If
'Concatenar
j = 5
n = 0
For i = 2 To u1
If h1.Range("A" & i).EntireRow.Hidden = False Then
h2.Cells(j, "A") = h1.Cells(i, "B") & " " & h1.Cells(i, "C") & " " & h1.Cells(i, "D")
h2.Cells(j, "B") = h1.Cells(i, "J")
j = j + 1
n = n + 1
End If
Next
h2.Range("B:B").NumberFormat = "$#,##0.00"
h2.Range("B1").NumberFormat = "#"
h2.Range("B1") = n
If h1.AutoFilterMode Then h1.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
.
'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias
.
Avísame cualquier duda
.