ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¤ÀªR¥i¯à­«ÂЪºÄæ­È¨Ã¦bListBox¤¤Add°ß¤@­È,Åý¤H­û¦n¿ï¡C

¤ÀªR¥i¯à­«ÂЪºÄæ­È¨Ã¦bListBox¤¤Add°ß¤@­È,Åý¤H­û¦n¿ï¡C

AÄæ   
A
A
A
B
B
B
C
C
D
E
F
F
G


¡¹Dept_Observing ¬Olist Box
   ÅܼÆA ¥u¬O§PÂ_Äæ¦ì­È¬O§_©Mlistbox ¬Û¦Pªº¯u°²­È¡C

­n¥ÎVBA À³¥Î , ¦Û¤v¼g¤F¤@¬qµ{¦¡¡A¬O¬°¤F¦blist box ¥u¦C¥X³æ¤@­È(A,B,C,D,E,F,G)µ¹¤H­û¤è«KÂI¿ï¡C
¦ýÁ`ı±oµ{¦¡«Üªø¡A¥i§_À°¦£Â²¤Æ©O¡H
For I = 1 To 20   
      A = 0
        Text_Flag = Area.Cells(I, 1)
                 For J = 0 To Dept_Observing.ListCount - 1
                     If Dept_Observing.List(J) = Text_Flag  Then
                        A = 1
                        Exit For
                     End If
                Next J
        If A = 0 And Text_Flag <> "" Then
             Dept_Observing.AddItem Text_Flag
        End If
  Next I
­É¿ú¤£ÁÙ¡A¤~¬O¤ý¹D

¥»©«³Ì«á¥Ñ linshin1999 ©ó 2011-1-16 20:15 ½s¿è

¦^´_ 1# apolloooo

Dim Text_Flag as Range
Dim sd() as integer, sd_val as integer

For Each Text_Flag In Selection
       Sd_val = Asc(Text_Flag.Value)
       If sd(s_val) = 0 Then
             sd(s_val) = 1
             Dept_Observing.AddItem Text_Flag.Value
       End If
Next
V98

TOP

Sub test()
    Dim arr, oDic As Object, i
    Set oDic = CreateObject("scripting.dictionary")
    With Sheet1
        arr = .Range("a1:a" & .[a65536].End(xlUp).Row)
    End With
    For i = 1 To UBound(arr)
        oDic(arr(i, 1)) = ""
    Next
    Dept_Observing.List = oDic.keys
    Set oDic = Nothing
End Sub
¤½ªÀ¬O´Êªø«CÃÃ,ªÀ­û³£¬OÃäWªº¥Ê.

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD