Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Remove Duplicates from Listbox

I did find the solution to this onece, but have seemed to lost it now.
Can some one point me int he right direction to removing any duplicate
values that are displayed in this code to populate a listbox?

Private Sub UserForm_Activate()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("Data").Cells(Rows.Count, "C").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
..Select
For myrow = 1 To LastCell
If .Cells(myrow, 3) < "" Then
If .Cells(myrow, 3) < "" Then
ListBox1.AddItem Cells(myrow, 3)
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub


Thank you in advance.

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Remove Duplicates from Listbox

try populating a collection object first

dim mycol as collection
set mycol =new collection
on error resume next
for i =1 to or some loop statement
mycol.add worksheet.cells(i,column),worksheet.cells(i,column )
loop
then fill list with collection items

"Coza" wrote:

I did find the solution to this onece, but have seemed to lost it now.
Can some one point me int he right direction to removing any duplicate
values that are displayed in this code to populate a listbox?

Private Sub UserForm_Activate()
Application.ScreenUpdating = False
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("Data").Cells(Rows.Count, "C").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
..Select
For myrow = 1 To LastCell
If .Cells(myrow, 3) < "" Then
If .Cells(myrow, 3) < "" Then
ListBox1.AddItem Cells(myrow, 3)
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub


Thank you in advance.

Corey....



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
Not allow duplicates from listbox to Worksheet Casey[_96_] Excel Programming 1 June 1st 06 03:50 PM
Remove duplicates Tuttamay77 Excel Discussion (Misc queries) 4 May 12th 06 10:56 PM
avoiding duplicates in listbox (added from another listbox) KR Excel Programming 4 March 14th 06 08:17 PM
remove duplicates in listbox bcorbin Excel Programming 2 May 20th 04 01:13 PM
Getting Duplicates in ListBox Tony Bender Excel Programming 2 September 26th 03 05:31 PM


All times are GMT +1. The time now is 09:54 PM.

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"