Hi
not tested but try the following (copies the entries starting from
sheet 2 to the first sheet):
Sub Copy_With_AutoFilter_2()
Dim WS As Worksheet
Dim WS2 As Worksheet
Dim rng As Range
Dim Str As String Dim ws_index Set WS = Sheets("sheet1")
Set WS2 = Sheets("Sheet1")
Str = "Netherlands" for ws_index = 2 to
activeworkbook.worksheets.count Set WS = Sheets(ws_index)
WS.Range("YourRange").AutoFilter Field:=1, Criteria1:=Str
'Use a Dynamic range name,
http://www.contextures.com/xlNames01.html#Dynamic
'This example filter on the first column in the range (change the
field if needed) With WS.AutoFilter.Range
On Error Resume Next
' This will not copy the header row each time
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count)
_
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.Copy WS2.Range("A" &
LastRow(WS2) + 1)
End With
WS.AutoFilterMode = False next
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
Carpie said:
That macro works fine but only for one sheet. I'm not a VBA guru by
any stretch, so is there a way you can tell me what modifications would
be needed to have it grab from multiple sheets?