Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AdvancedFilter Method in Excel 2000 vba 1

Status
Not open for further replies.

corsair2

IS-IT--Management
Feb 21, 2001
55
GB
I'm using the AdvancedFilter method to filter a previously named range of data for unique entries which I then copy to a different part of the spreadsheet.
This works fine except that the first data entry in the original range is always repeated in the subsequent (supposedly unique) list.
I enclose a fragment of the code -

Worksheets("Sheet1").Range("StatSelect").Select
With Selection
.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(40, 10), Unique:=True
End With

No header information is included in the original range selection.
Is the glitch in my code or the method?
Any ideas?

regards

Steve
 
The problem is....
Excel thinks that the first row in your 'StatSelect' range is a header row, so it is copying it as a header. (Then it is copying the first row <again> as a unique value.

I'm not sure if the setting can be changed, so to me the easiest solution is to make the first row of 'StatSelect' a header row.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top