J
John
Is it possible to use non-contiguous ranges with the vba code for advanced
filters?
I can not get the example code to work.
Example of code:
Sub TestCode()
On Error GoTo Err_Text
Dim oWB As String
Dim oJoinNewRng01 As Range
oWB = Application.ActiveWorkbook.Name
Set oJoinNewRng01 =
Union(Workbooks(oWB).Sheets("Sheet1").Range("A10:A14"), Range("E10:G14"))
oJoinNewRng01.Select
oJoinNewRng01.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Workbooks(oWB).Sheets("Sheet1").Range("Criteria"), _
CopyToRange:=Workbooks(oWB).Sheets("Sheet1").Range("I10:L10"), _
Unique:=False
Exit_Text:
Exit Sub
Err_Text:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Text
End Sub
filters?
I can not get the example code to work.
Example of code:
Sub TestCode()
On Error GoTo Err_Text
Dim oWB As String
Dim oJoinNewRng01 As Range
oWB = Application.ActiveWorkbook.Name
Set oJoinNewRng01 =
Union(Workbooks(oWB).Sheets("Sheet1").Range("A10:A14"), Range("E10:G14"))
oJoinNewRng01.Select
oJoinNewRng01.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Workbooks(oWB).Sheets("Sheet1").Range("Criteria"), _
CopyToRange:=Workbooks(oWB).Sheets("Sheet1").Range("I10:L10"), _
Unique:=False
Exit_Text:
Exit Sub
Err_Text:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Text
End Sub