View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
david shapiro david shapiro is offline
external usenet poster
 
Posts: 23
Default urgent - changing a range

Hi,

A bit urgent - Does anyone know why this isn`t working? The code is to
do an advanced filter taking the full range of data in a worksheet? If
possible, I`d like to alter it to put the results of the filter in a new
sheet. Thanks.

Dave

"source data" - the main file which is being filtered from.
"criteria file" - the criteria for the filter


Dim rngData As Range, RngCrit As Range
Dim rngOutput As Range

With ActiveWorkbook
With .Sheets("source data")
Set rngData = .Range("A1").CurrentRegion ' End With

With .Sheets("criteria file")
Set RngCrit = .Range("A1").CurrentRegion '
Set rngOutput = .Range("A1")
End With

.Sheets("criteria file").Activate
rngData.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=RngCrit, _
CopyToRange:=rngOutput, _
Unique:=True
End With


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!