Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default List of Different Cells


In sheet1.range("b:b") I have a list of numbers. Some of the numbers
will repeat, some won't. In userform1.combobox1 I want to list all of
the different numbers (no repeats) from sheet1.range("b:b"). What is
the easiest way to do this?

Big Thanks.


--
ForSale
------------------------------------------------------------------------
ForSale's Profile: http://www.excelforum.com/member.php...o&userid=11896
View this thread: http://www.excelforum.com/showthread...hreadid=552094

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default List of Different Cells


try

Code:
--------------------

Private Sub UserForm_Initialize()
Dim dic As Object, a, e
Set dic = CreateObject("scripting.dictionary")
dic.comparemode = vbTextCompare
With Sheets("Sheet1")
a = .Range("b1",.Range("b" & Rows.Count).End(xlUp)).Value
End With
For Each e In a
If Not IsEmpty(e) And Not dic.exists(e) Then dic.add e, Nothing
Next
If dic.count < 1 Then Exit Sub
Me.ListBox1.List = dic.keys
Set dic = Nothing
End Sub

--------------------


--
jindon
------------------------------------------------------------------------
jindon's Profile: http://www.excelforum.com/member.php...o&userid=13135
View this thread: http://www.excelforum.com/showthread...hreadid=552094

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default List of Different Cells


Fantastic! Now I just wish I could understand that.

Thanks.


--
ForSale
------------------------------------------------------------------------
ForSale's Profile: http://www.excelforum.com/member.php...o&userid=11896
View this thread: http://www.excelforum.com/showthread...hreadid=552094

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
If adjacent cells both contain a match from a list, they, and 2 more adj. cells are cLING Excel Worksheet Functions 0 January 5th 11 06:49 AM
Sort a list with cells referring to others cells Friis(DK) Excel Discussion (Misc queries) 6 February 24th 07 03:56 AM
Sorting cells: a list behind the cells do not move with the cell Ross M Excel Discussion (Misc queries) 2 September 21st 06 12:14 PM
Remove empty cells from named list / validation list Sp00k Excel Worksheet Functions 4 April 28th 06 03:45 PM
Condensing a list/range with blank cells to a new list/range without blanks KR Excel Worksheet Functions 4 July 5th 05 04:23 PM


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