D
Darin Kramer
Hi There,
I have written a macro that selects from column D, using autofilter TWO
sets of data and copies and pastes it into a new book. Problem is I now
need to filter data for three conditions, ie condition 1 or condition 2
or condition 3. Excel autofilter only seems to have to custom filters...
Im sure it can be done in VB....
My original code is below, any help graciously accepted...
Thanks
D
Sub test()
With Sheets("a").Range("A1:e150")
.AutoFilter Field:=4, Criteria1:="1", Operator:=xlOr, _
Criteria2:="=2"
.SpecialCells(xlCellTypeVisible).Copy _
Sheets.Add
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Cells.Select
Selection.RowHeight = 15
ActiveWindow.Zoom = 80
ActiveSheet.Name = "a_new"
'Now remove the autofilter
.AutoFilter
End With
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
I have written a macro that selects from column D, using autofilter TWO
sets of data and copies and pastes it into a new book. Problem is I now
need to filter data for three conditions, ie condition 1 or condition 2
or condition 3. Excel autofilter only seems to have to custom filters...
Im sure it can be done in VB....
My original code is below, any help graciously accepted...
Thanks
D
Sub test()
With Sheets("a").Range("A1:e150")
.AutoFilter Field:=4, Criteria1:="1", Operator:=xlOr, _
Criteria2:="=2"
.SpecialCells(xlCellTypeVisible).Copy _
Sheets.Add
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Cells.Select
Selection.RowHeight = 15
ActiveWindow.Zoom = 80
ActiveSheet.Name = "a_new"
'Now remove the autofilter
.AutoFilter
End With
End Sub
*** Sent via Developersdex http://www.developersdex.com ***