OK, without any kind of logic behind the ranges it's hard to write anything that will create them on the fly, so for a hardcoded approach (Which I really struggle to believe has to be the case on some 200 sheets), you can use the following to get started:-
Sub FilterData()
Dim RngIn As Range
Dim RngOut As Range
Set RngIn = Range("H1:H36")
Set RngOut = Range("A40")
Application.ScreenUpdating = False
With RngIn
.AutoFilter Field:=1, Criteria1:="<=10", Operator:=xlAnd
.SpecialCells(xlCellTypeVisible).Copy
RngOut.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
.AutoFilter
End With
Application.CutCopyMode = False
Range("A1").Select
Application.ScreenUpdating = True
End Sub
If you can find some logic behind the ranges then you might want to look at ways of determining the ranges automatically, and to this end you may find the following code examples helpful:-
Determine last used row in Col A:-
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Determine last used row in Col A in a defined sheet:-
LastRw = Sht1.Cells(Rows.Count, "A").End(xlUp).Row
Use the above to set a range down to last row:-
Set Rng = Sht2.Range(Cells(LastRw + 1, "A"), Cells(Rows.Count, "A"))
Find last used Column in usedrange (Not foolproof)
ColW = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count
Find last row in usedrange (Not foolproof):-
lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
The reason I say the last two are not foolproof is that the usedrange can sometimes return erroneous results, and Excel can often think it is larger than it is.
For running through multiple sheets:-
Dim wkSht As Worksheet
For Each wkSht In Worksheets
With wkSht
If blah blah blah then
do this
End If
End With
Next wkSht
End Sub
Regards
Ken............
----------------------------------------------------------------------------
![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
It's easier to beg forgiveness than ask permission
----------------------------------------------------------------------------