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

Hi

Yet another question on my project I am afraid :(

I have data in a sheet called "FULL RECORD" which I want to filter to
another sheet called "FILTERED DATA"

Ful Record has a named range called "PivotData" which includes the
data and the header row.

The workbook will be distributed amongst several users and to try to
ensure that I cater for changes to the file name, and avoid conflicts
with other workbooks (eg in case the user creates an old copy), I
have tried to specify that the filter only looks to this workbook for
the range.

At the relevant point the sheet "FILTERED DATA" is active, and
mycode is

MySOPWorkbook = ThisWorkbook.Name
Range(MySOPWorkbook + "!PivotData").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("FULL RECORD").Range("L2:M3"), CopyToRange _
:=Range("A7:BQ7"), Unique:=False


NB Range("L2:M3") is a date range above the data to be filtered

This works exactly as I want it to - as long as the file name has no
spaces in it. Otherwise it produces an error.

Can anyone suggest how I can cater for filenames with spaces?

TIA

LS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Advanced Filter & Named Range

I think I'd just use:

worksheets("full Record").range("pivotData").advancedfilter _
action:=....

But I'd fully qualify that copytorange, too:

worksheets("full Record").range("pivotData").advancedfilter _
action:=xlFilterCopy, _
CriteriaRange:=Sheets("FULL RECORD").Range("L2:M3"), _
CopyToRange:=worksheets("filtered data").Range("A7:BQ7"), Unique:=False


LS wrote:

Hi

Yet another question on my project I am afraid :(

I have data in a sheet called "FULL RECORD" which I want to filter to
another sheet called "FILTERED DATA"

Ful Record has a named range called "PivotData" which includes the
data and the header row.

The workbook will be distributed amongst several users and to try to
ensure that I cater for changes to the file name, and avoid conflicts
with other workbooks (eg in case the user creates an old copy), I
have tried to specify that the filter only looks to this workbook for
the range.

At the relevant point the sheet "FILTERED DATA" is active, and
mycode is

MySOPWorkbook = ThisWorkbook.Name
Range(MySOPWorkbook + "!PivotData").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("FULL RECORD").Range("L2:M3"), CopyToRange _
:=Range("A7:BQ7"), Unique:=False

NB Range("L2:M3") is a date range above the data to be filtered

This works exactly as I want it to - as long as the file name has no
spaces in it. Otherwise it produces an error.

Can anyone suggest how I can cater for filenames with spaces?

TIA

LS


--

Dave Peterson

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

Thanks for the suggestion Dave, unfortunately I still get an error
at that point, caused by spaces in the filename.

LS

Dave Peterson wrote in message ...
I think I'd just use:

worksheets("full Record").range("pivotData").advancedfilter _
action:=....

But I'd fully qualify that copytorange, too:

worksheets("full Record").range("pivotData").advancedfilter _
action:=xlFilterCopy, _
CriteriaRange:=Sheets("FULL RECORD").Range("L2:M3"), _
CopyToRange:=worksheets("filtered data").Range("A7:BQ7"), Unique:=False


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Advanced Filter & Named Range

Even if you qualified it completely:

thisworkbook.worksheets("full Record").range("pivotData").advancedfilter _
action:=....

(I left thisworkbook off by mistake, sorry.)

PivotData is on worksheet "full record", right?

LS wrote:

Thanks for the suggestion Dave, unfortunately I still get an error
at that point, caused by spaces in the filename.

LS

Dave Peterson wrote in message ...
I think I'd just use:

worksheets("full Record").range("pivotData").advancedfilter _
action:=....

But I'd fully qualify that copytorange, too:

worksheets("full Record").range("pivotData").advancedfilter _
action:=xlFilterCopy, _
CriteriaRange:=Sheets("FULL RECORD").Range("L2:M3"), _
CopyToRange:=worksheets("filtered data").Range("A7:BQ7"), Unique:=False



--

Dave Peterson

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
Hlp! Named range Advanced Filter Criterion Joyce Excel Discussion (Misc queries) 10 March 3rd 10 02:04 PM
Advanced Filter - Named Ranges Bull Excel Worksheet Functions 1 April 30th 09 05:04 AM
Advanced Filter using a range name as the criteria Joe Excel Worksheet Functions 1 December 27th 08 06:23 PM
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


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