Filter trought rows

JuanchoCR

New Member
Joined
May 23, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Mobile
Hi,

I have this code, but isn't working.
The code is recognize the first row but now going to the next one and filter the others rows.
Any suggestions?

Sub filter4()


Dim rng As range
Dim ul As Long
Dim celda As Variant
Dim lr As Long



ul = Worksheets("Count").Cells(Rows.Count, "A").End(xlUp).Row
lr = Worksheets("List").Cells(Rows.Count, "D").End(xlUp).Row
Set rng = ActiveWorkbook.Sheets("Count").range("A2")
Set celda = Worksheets("Count").range("A2")




For celda = 1 To ul


Sheets("Temp").Select
range("A:D").Delete
Sheets("List").Select

If celda <> "" Then
Worksheets("List").range("$A$1:$D$66").AutoFilter Field:=2, Criteria1:=rng

Sheets("Count").Select
ActiveCell.Offset(1, 0).Select

End If

Selection.CurrentRegion.Copy
Sheets("Temp").Select
range("A1").PasteSpecial xlPasteValues
range("A1").PasteSpecial xlPasteFormats
Cells.EntireColumn.AutoFit


Next celda
 

Attachments

  • Base massive.jpg
    Base massive.jpg
    91.3 KB · Views: 5
  • Email examples.jpg
    Email examples.jpg
    50.4 KB · Views: 5

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,216,473
Messages
6,130,837
Members
449,597
Latest member
buikhanhsang

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top