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: 11
Default RANGE NAMES IN MACRO WITH ADVANCED FILTERING

Advanced Filtering is a great tool while using Macro's.
So far it has been working perfectly with ranges consisting of Cell names
like the example below:
Sheets("2 Air").Select
Application.Goto Reference:="NO2"
ActiveCell.FormulaR1C1 = "NO"
Range("A3:X503").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"A531:X532"), CopyToRange:=Range("A536:X636"), Unique:=False
ActiveWindow.SmallScroll Down:=11
ActiveWindow.ScrollWorkbookTabs Position:=xlLast

However I need to make to the ranges variable as number of lines above will
vary. So I defined the ranges:

A3:X503 as Lines1
A531:X532 as CRIT1
A536:X736 as ADVFILTRES1

I changed the macro as follows:
Sheets("2 Air").Select
Application.Goto Reference:="NO2"
ActiveCell.FormulaR1C1 = "NO"
Range("Lines1").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"CRIT1"), CopyToRange:=Range("ADVFILTRES1"), Unique:=False
ActiveWindow.SmallScroll Down:=11
ActiveWindow.ScrollWorkbookTabs Position:=xlLast

RESULT the Macro stops and highlights the AdvancedFilter line.
Range(lines1).xxx or Lines1.xxx or "Lines1".xxx did not improve anything.

Can somebody tell me what I am doing wrong?

Thank you very much for you help. I really appreciate this Discussion Group.





 
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
Advanced filtering macro Sandy Excel Worksheet Functions 2 May 1st 07 04:16 PM
Advanced Filtering by Date (or Macro) Help Alexis Excel Worksheet Functions 1 March 8th 06 05:09 PM
Advanced Filtering Extract Range Missing,etc bridges_22 Excel Worksheet Functions 1 February 6th 06 04:19 PM
Macro to perform Advanced Filtering Spencer Hutton Excel Programming 0 April 23rd 05 01:32 PM


All times are GMT +1. The time now is 12:36 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"