Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default User Form List box, unique records listing

I have a user form with a list box that I would like to show the unique
records from one column in a worksheet.

I've thought about several ways to do this but was wondering if there is a
really easy way using arrays. The unique records would only need to be
available for this list box so I don't need to store them anywhere but the
list will change frequently.

Any help or thoughts would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default User Form List box, unique records listing

Hi Rominall,

You could use advanced filter and create a tempory unique list somewhere out
of the way on your worksheet and name it. Then set the Rowsource property of
the test box to the named range as per the following code. The unique list
and named range can be deleted when no longer required.

Note that unique copies with Advanced filter can only be done on the same
worksheet.

Sub Macro1()

'NOTE: Set Rowsource property of text box to TxtBoxRng

Dim rngFilter
Dim rngUnique As Range

'Edit column Id to suit your column
'Include column header for advanced filter
With Sheets("Sheet1")
Set rngFilter = Range(.Cells(1, "A"), _
.Cells(.Rows.Count, "A").End(xlUp))
End With

rngFilter.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("Z1"), Unique:=True

'Edit column Id to suit somewhere out of the way
'on your worksheet. Row starts from row 2 so that
'column header not in text box
With Sheets("Sheet1")
Set rngUnique = Range(.Cells(2, "Z"), _
.Cells(.Rows.Count, "Z").End(xlUp))
End With

ActiveWorkbook.Names.Add Name:="TxtBoxRng", _
RefersToR1C1:=rngUnique

UserForm1.Show

End Sub


--
Regards,

OssieMac


"Rominall" wrote:

I have a user form with a list box that I would like to show the unique
records from one column in a worksheet.

I've thought about several ways to do this but was wondering if there is a
really easy way using arrays. The unique records would only need to be
available for this list box so I don't need to store them anywhere but the
list will change frequently.

Any help or thoughts would be appreciated.

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
Listing unique values, frequency, and maintaining list order integrity Alan[_13_] Excel Worksheet Functions 0 September 7th 11 06:58 PM
create a separate list for unique records eva cheng Excel Discussion (Misc queries) 3 April 28th 10 10:53 AM
Multiple sheets, one user form, and a unique ID [email protected] Excel Programming 1 March 6th 06 05:30 PM
how to get the number of unique records in a list louisp Excel Worksheet Functions 10 February 14th 06 12:02 AM
Finding unique records from a list. Shanks Excel Discussion (Misc queries) 4 February 24th 05 10:01 AM


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