473,512 Members | 15,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating unique data from sheet to form

6 New Member
Hello, I'm wondering if there is an easy way of populating the unique records in an excel column to a listbox or combobox. I am thinking of doing something like
Expand|Select|Wrap|Line Numbers
  1.     For r = 2 To 128
  2.             With CB_List
  3.                 For n = 0 To .ListCount
  4.                     If .List(n, 0) = Sheets("Testsheet").Cells(r, "U") Then
  5.                         Exit For
  6.                     End If
  7.                 Next n
  8.                 If n = .ListCount + 1 Then
  9.                     .AddItem
  10.                     .ColumnCount = 1
  11.                     .List(.ListCount - 1, 0) = Sheets("Testsheet").Cells(r, "U")
  12.                 End If
  13.  
  14.             End With
  15.     Next r
  16.  
Which does not work right now, but will eventually. I just thought there must be a simpler way. Does anyone know if there is such a way?

Best regards, Johan
Nov 3 '08 #1
1 1130
ubentook
58 New Member
Add the items from the Excel list to a Collection.
A Collection object will not accept duplicates.
Then add the contents of the Collection to the listbox.
Nov 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3139
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
5
2264
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
6
2492
by: eureka | last post by:
Hi friends, I am developing a web application using Jsp and JS. I have a main Jsp page(Jsp1).Inside it I have an iframe having an Html- table which is created dynamically and contains all...
0
1673
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
1
2445
by: canam | last post by:
I hope someone can help me with this. I have an input form with a subform that opens up in data sheet view. The subform is called based on 2 fields - BusinessName & Commodity - in other words...
5
1779
by: a Wellner | last post by:
I am trying to create a from that the user can select a street from a combo box (named street), then pick a second street from another combo box, containing only valid cross streets(named Cross). ...
4
20016
by: prosad | last post by:
hello, Just solved a problem using Javascript onclick, can click on any cell in a dynamic table and it will pass the innerText object value to my form text field. parts of code given below: ...
2
1951
by: lindabaldwin | last post by:
Hello everyone, I am fairly new to VBA. I have a worksheet in Excel, named "Data Sheet" from which I am trying to query data. This worksheet contains the following data: unit (column A), date...
7
13143
by: kpresidente | last post by:
Hello all, I'm trying to transfer the value of a control on an Access form to an Excel worksheet using VBA. The Access form is a single form with all the controls disabled, so that data is "read...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.