Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Advanced Filtering in VBA

I would like to make this procedure more flexible by using relative
references
rather than absolute cell references. The first version works
perfectly but I can't get the second version to work. It always
results in all lines disappearing. I know this may be difficult to
resolve without seeing the sheet it is used on but perhaps there is
just a basic coding error. Thanks in advance
for any help.

Public Sub LedgerView()
'
Range("A5").Select
Range("A6:G260").AdvancedFilter _
Action:=xlFilterInPlace, CriteriaRange:=Range("B1:D3"),
Unique:=False
Range("A5").Select

' Range("A6").Select
' Range(Selection, Selection).CurrentRegion.Select
' Selection.AdvancedFilter _
' Action:=xlFilterInPlace, CriteriaRange:=Range("B1:D3"),
Unique:=False
' Range("A5").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Advanced Filtering in VBA

John,

It worked for me - but you could simplify the code to:

Public Sub LedgerView()

Range("A6").CurrentRegion.AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("B1:D3"), _
Unique:=False

End Sub

Tim
-----Original Message-----
I would like to make this procedure more flexible by

using relative
references
rather than absolute cell references. The first version

works
perfectly but I can't get the second version to work. It

always
results in all lines disappearing. I know this may be

difficult to
resolve without seeing the sheet it is used on but

perhaps there is
just a basic coding error. Thanks in advance
for any help.

Public Sub LedgerView()
'
Range("A5").Select
Range("A6:G260").AdvancedFilter _
Action:=xlFilterInPlace, CriteriaRange:=Range

("B1:D3"),
Unique:=False
Range("A5").Select

' Range("A6").Select
' Range(Selection, Selection).CurrentRegion.Select
' Selection.AdvancedFilter _
' Action:=xlFilterInPlace, CriteriaRange:=Range

("B1:D3"),
Unique:=False
' Range("A5").Select

End Sub
.

Reply
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 Filtering Kirk P. Excel Discussion (Misc queries) 2 November 19th 09 05:26 PM
how do i use advanced filtering? erik Excel Worksheet Functions 2 October 18th 08 07:14 PM
Advanced Filtering [email protected] Excel Discussion (Misc queries) 2 August 20th 07 12:20 AM
Advanced Filtering..... Louise Excel Worksheet Functions 4 December 14th 05 08:55 PM
Advanced filtering glassjo Excel Discussion (Misc queries) 1 September 25th 05 08:09 PM


All times are GMT +1. The time now is 03:02 PM.

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

About Us

"It's about Microsoft Excel"