LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
AC AC is offline
external usenet poster
 
Posts: 5
Default Unique item list still returns duplicates

Hello,
I have a list in Excel that contains records with duplicate numbers. I
am trying to filter this list via VBA to retrieve only unique records
and place that list on another sheet in the same wb.

I have given the column that contains the duplicate numbers a dynamic
named range with the following formula:
dub_range=OFFSET($A$1,0,0,COUNTA($A:$A))

The VBA code, which I found on ozgrid is listed below. When I run this
code it seems to work, except that for some reason the very first item
in the list is returned at the very top of my filtered list,
regardless of where it would normally appear in a sorted list and it
also appears in the list where it normally should appear in a sorted
list.

Sub UniqueList()
Dim rListSort As Range, rOldList As Range
Dim strListFill As String

'Clear Hidden sheet Column A ready for list
Sheet8.Range("N1", Sheet8.Range("N65536").End(xlUp)).Clear


'Set range variable to list we want
Set rOldList = Sheet2.Range("PO_Number")

'Use AdvancedFilter to copy the list to Column A _
of the hidden sheet and remove all dupes
rOldList.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheet8.Cells(1, 14), Unique:=True

'Set range variable to the new non dupe list
Set rListSort = Sheet8.Range("N1",
Sheet8.Range("N65536").End(xlUp))

'Sort the new non dupe list
With rListSort
.Sort Key1:=Range("N1"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal
End With

strListFill = Sheet8.Name & "!" & Sheet8.Range _
("N1", Sheet8.Range("N65536").End(xlUp)).Address

Sheet8.cbo_PO.ListFillRange = vbNullString
Sheet8.cbo_PO.ListFillRange = strListFill
End Sub


All help is greatly appreciated.

Thanks in advance.
Regards,
A. Crawford

 
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
How do I delete unique numbers from a list and save duplicates? Kevin Alcock Excel Worksheet Functions 4 November 24th 08 04:50 PM
Array Offset() formula with height of 1 returns duplicates? Uhl Excel Worksheet Functions 9 December 13th 06 01:22 AM
Array Formulas - Unique List from List with Duplicates Johnny Meredith Excel Discussion (Misc queries) 7 October 27th 06 09:26 PM
Question about what the Find function returns if the item wasn't found JC10001 Excel Programming 4 April 6th 04 02:44 AM
Add Unique item to Collection Dick Kusleika[_3_] Excel Programming 8 January 21st 04 08:59 PM


All times are GMT +1. The time now is 08:26 AM.

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"