Just nu i M3-nätverket
Jump to content

unika värden i en combobox


Viktor79

Recommended Posts

 

Hej igen

 

Jag har en excelkolumn som ser ut som

 

A

E

F

R

D

A

A

D

R

 

men när jag lagrar den i combobox vill jag endast ha unika värden.

 

Ngn som vet en bra metod för det? Jag har kikat lite på GetPivotData men får det inte riktigt att funka

 

Link to comment
Share on other sites

VBA kod, ett exempel:

Sub MyFill()

   Dim myRn As Range, myCell As Range
   Set myRn = Range("a1:a8")
   Dim myDict As Object
   Set myDict = CreateObject("Scripting.Dictionary")
   For Each myCell In myRn
       If Not myDict.exists(myCell.Text) Then
           myDict.Add myCell.Text, "dummy"
       End If
   Next myCell
   Dim myArr()
   ReDim myArr(myDict.Count)
   myArr = myDict.keys
   Me.ListBox1.List() = myDict.keys
End Sub

 

 

/T

 

Even when we know we´ll never find the answers, we have to keep on asking questions.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...