LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Advanced Filter with Non-Contiguous Ranges

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:A 14"), Range("E10:G14"))

oJoinNewRng01.Select


oJoinNewRng01.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Workbooks(oWB).Sheets("Sheet1").Ran ge("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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Filter - Named Ranges Bull Excel Worksheet Functions 1 April 30th 09 05:04 AM
advanced filter dialog box, "List Range" list two ranges? Excel_Kiwi Excel Worksheet Functions 1 October 27th 08 06:11 PM
Advanced filter: criteria in non-adjacent ranges? count Excel Programming 1 October 11th 05 02:22 PM
Advanced filter in VBA - criteria in non-adjacent ranges count Excel Programming 1 October 11th 05 01:27 PM
Date ranges and advanced filter rt Excel Programming 3 December 1st 04 09:12 PM


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"