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

vba combobox ¤£­«½Æ¸ê®ÆªºADD ¤è¦¡

vba combobox ¤£­«½Æ¸ê®ÆªºADD ¤è¦¡

½Ð°Ý¨Ì¤U
vba combobox ¸ê®ÆADD ¤è¦¡ ­n¦p¦ó¤£­«½Æ¥Î

¸ê®Æ¨Ó·½¬°Àx¦s®æ

¦^´_ 1# stran


    ¼Ó¥Dªº·N«ä¬O?
¸ê®Æ¤º¦³­«½Æ?  ¦ÓADD¤£­«½Æªº¸ê®Æ?

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

3K701
3K702
3K702
3K702
3K703
3K704
3K701
3K702
3K707
3K703

¨Ò¦p AÄæ¦ì ¦³¥H¤W¸ê®Æ
·Q­n¶i¦æ ComboBox.additem  §@·~

½Ð°Ý¦p¦ó°µ¥X¤£­«½Æ¸ê®Æªº¿ï³æ

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-11-1 15:33 ½s¿è

¦^´_ 3# stran


    ³o°ÝÃD~³o¸Ìªº¦Ñ®v­Ì¦³±Ð¹L§Ú~Á|¨Ò¦p¤U
Private Sub UserForm_Initialize()
    Dim A As Range
    Set d = CreateObject("Scripting.Dictionary")
    With Sheets("Sheet1")
        .Activate
        For Each A In .Range("A1", .[a1].End(xlDown))
          d(A.Value) = IIf(d(A.Value) = "", A.Offset(, 1).Value, d(A.Value) & "," & A.Offset(, 1))
        Next
        ComboBox1.List = d.keys
    End With
End Sub


¥H¤W½d¨Ò¬°~·í¸ê®Æ¦bAÄæ~­Y­n¦b¨ä¥LÄæ¦ì½Ð§ó§ï³o¬q
For Each A In .Range("A1", .[a1].End(xlDown))
­Y­n§ï¦¨BÄæ¥u­n±N³o¬qªºA1©Ma1~§ï¦¨B1©Mb1§Y¥i
¥H¤W¬O³Â»¶±Ð®vªº¦Ñ®v­Ì«ü¾Éªº~¤£ª¾¹D¦³¨S¦³²Å¦X§A­nªºµª®×!?

TOP

½Ð°Ý¦U¦ì,¦³¤èªk§â¤W­±±o¥X¨Óªºµ²ªG¦A±Æ§Ç¶Ü?
¦]¬°§Ú¥Î¥H¤W§ÚScripting.Dictionary½T¹ê§ä¨ì§Ú­nªºªF¦è,¥i¬O¤£¬O¶¶§Çªº

¥t¥~¦³¤èªk§â¤é´Á¹w³]¬°«e¤@¤Ñ¤u§@¤Ñ(§Y¤£¥]¬A¬P´Á¤»¤é)¶Ü?

TOP

¦^´_ 5# SteveChm
  1. Option Explicit
  2. Private Sub UserForm_Initialize()
  3.     Dim d As Object, A   As Range, i As Integer
  4.     Set d = CreateObject("Scripting.Dictionary")
  5.     With Sheets("Sheet1")
  6.         .Activate
  7.         For Each A In .Range("A1", .[a1].End(xlDown))
  8.           d(CDbl(A.Value)) = A.Value
  9.         Next
  10.         For i = 1 To d.Count
  11.            ComboBox1.AddItem d(Application.Small(d.keys, i))
  12.         Next
  13.     End With
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2014/2/13 06:36): ­n¤W¶ÇÀɮ׬ݷZ

GBKEE¤j¤j, ·PÁ§Aªº¦^ÂÐ,
¥i¬O§Ú§â§AªºCODE©ñ¨ì§ÚªºÀÉ®×°õ¦æ,¥X²{¤F¿ù»~13,«¬ºA¤£²Å¦X.½Ð°Ý¬O¨º¸Ì¥X°ÝÃD¤F?

¥t¥~½Ð°Ý¥i¥H¹w³]combo box ¤Jªº¼Æ­È(·í¤Ñªº«e¤@­Ó¤u§@¤Ñ)¦Ó¤£¬OªÅ¥Õ¶Ü?

ÁÂÁ§Aªº¦^ÂÐ

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD