Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Advanced Filter to Dynamic Range

I've applied an Advanced Filter to a Range and simply recorded the macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Advanced Filter to Dynamic Range

Sheets("Database").Select
Range("A1").CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy,
CriteriaRange:=Range("V1:V2"), _
CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select

--
Regards,
Tom Ogilvy



"John" wrote in message
...
I've applied an Advanced Filter to a Range and simply recorded the macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Advanced Filter to Dynamic Range

Dim LastRow as Long
LastRow = Sheets("Database").Cells(Rows.Count,1).End(xlup).R ow


With Sheets("Database").Select
Range("A1:T" & LastRow).AdvancedFilter Action:=xlFilterCopy,

CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select

--
Cheers
Nigel



"John" wrote in message
...
I've applied an Advanced Filter to a Range and simply recorded the macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Advanced Filter to Dynamic Range

Thanks Guys

"Nigel" wrote in message
...
Dim LastRow as Long
LastRow = Sheets("Database").Cells(Rows.Count,1).End(xlup).R ow


With Sheets("Database").Select
Range("A1:T" & LastRow).AdvancedFilter Action:=xlFilterCopy,

CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select

--
Cheers
Nigel



"John" wrote in message
...
I've applied an Advanced Filter to a Range and simply recorded the macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Advanced Filter to Dynamic Range

Guys I'm getting a syntax error on both your codes, am I missing something?
Where does the 'CurrentRegion' come from?


"Nigel" wrote in message
...
Dim LastRow as Long
LastRow = Sheets("Database").Cells(Rows.Count,1).End(xlup).R ow


With Sheets("Database").Select
Range("A1:T" & LastRow).AdvancedFilter Action:=xlFilterCopy,

CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select

--
Cheers
Nigel



"John" wrote in message
...
I've applied an Advanced Filter to a Range and simply recorded the macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Advanced Filter to Dynamic Range

Guys got it working, must have paste it incorrectly

Thanks


"John" wrote in message
...
Guys I'm getting a syntax error on both your codes, am I missing
something? Where does the 'CurrentRegion' come from?


"Nigel" wrote in message
...
Dim LastRow as Long
LastRow = Sheets("Database").Cells(Rows.Count,1).End(xlup).R ow


With Sheets("Database").Select
Range("A1:T" & LastRow).AdvancedFilter Action:=xlFilterCopy,

CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select

--
Cheers
Nigel



"John" wrote in message
...
I've applied an Advanced Filter to a Range and simply recorded the
macro,
extract below, but my problem is that my data in the Database sheet is
dynamic and changes in Row length (not by column)

How can I incorporate a dynamic range via VBA with Advanced Filters?

Thanks



Sheets("Database").Select
Range("A1:T61").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"V1:V2"), CopyToRange:=Range("X1:AQ1"), Unique:=False
Range("A1").Select








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 Filter using a range name as the criteria Joe Excel Worksheet Functions 1 December 27th 08 06:23 PM
Advanced filter a dynamic date range oneandoneis2 Excel Worksheet Functions 2 April 6th 06 08:57 AM
advanced filter a range Il Principe Excel Worksheet Functions 2 August 1st 05 03:27 PM
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du TC Excel Worksheet Functions 1 May 12th 05 02:06 AM
Advanced Filter & Named Range LS[_2_] Excel Programming 3 April 7th 04 02:28 AM


All times are GMT +1. The time now is 07:57 AM.

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"