LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default ListBox

Hello,

I am trying to create a 2 column listbox using data from column "O" and
column "I" in a spreadsheet. Additionally, there are duplicate values in
these columns. I would like to remove any duplicates so the Listbox only
shows one of each value in the list. Also, no blank rows. Below is code that
I have used for one column, but I am not familiar with creating two columns
and then removing any duplicate values. Any help would be greatly
appreciated. Thank You,


Dim myRng As Range
Dim myCell As Range


With ActiveSheet
Set myRng = .Range("O1", .Cells(.Rows.Count, "O").End(xlUp))
End With

For Each myCell In myRng.Cells
If myCell.Value = 0 Or myCell.Value = "SPC" Then
Else
Me.ListBox1.AddItem myCell.Value
End If
Next myCell



 
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
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
Modification of listbox to listbox code Sam S via OfficeKB.com Excel Programming 0 July 28th 05 12:02 PM
Modification of listbox to listbox code R.VENKATARAMAN Excel Programming 0 July 28th 05 05:36 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


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