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

[µo°Ý] ¦p¦ó¤j¶q«Ø¥ßCOMBOBOX ªí³æ¤è¦¡

¦^´_ 6# lichang
¤U­±¬O¤@²³æ¨Ò¤l
form1.JPG
UserForm1 µ{¦¡½X
  1. Private Temp() As Class1

  2. Private Sub UserForm_Initialize()
  3.     Dim i As Long
  4.     For i = 1 To 4
  5.         ReDim Preserve Temp(i)
  6.         Set Temp(i) = New Class1
  7.         Temp(i).InitialControl Controls("ComboBox" & i)
  8.     Next
  9. End Sub
½Æ»s¥N½X
·s¼Wª«¥óÃþ§O¼Ò²Õ Class1
  1. Public WithEvents ComboBox As MSForms.ComboBox

  2. Private Sub ComboBox_Change()
  3.     MsgBox ComboBox.Value    'change °Ê§@
  4. End Sub

  5. Public Sub InitialControl(ByRef oControl As MSForms.ComboBox)
  6.     Set ComboBox = oControl
  7.     ComboBox.List = Array("test1", "test2", "test3", "test4")
  8. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 6# lichang
¦pªG­n¦@¥Î Click ªºÄ²µo¦æ¬°(´N¬O¦@¥Îclick event)
´N­n¹³ #5¼Ó³o¼Ë , §ï¥Îª«¥óÃþ§O¼Ò²Õ³á~
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 3# stillfish00

¨º½Ð°Ý¤@¤U³á!!¨º§ÚªºCOMBOBOX_CLICK ¦³¿ìªk¤@¼Ëªº¤è¦¡³B²z¶Ü??

TOP

¥»©«³Ì«á¥Ñ mark15jill ©ó 2015-3-30 23:30 ½s¿è

¦^´_ 3# stillfish00

¯d´X­Ó¥ñµ§Åý§A½m²ß...
¥H¤Uµ{¦¡½X¬°°ÊºA³Ð 8*4 ­Ócombobox   ¨C­Ócombobox ¦Û°Ê¥[¤J 32µ§¸ê®Æ(½d¨ÒÀÉ  ¸ê®Æ§Ú¬O¥á¦bEÄæ¦ì)
¸m©ó °ÊºA·s¼Wªºcombobox Åܧó®É¡A´N­n©p¦Û¤v¥h³]©w·Q­nªº¥\¯à+ÅܼƤF~


  1. Dim  thecombobox() As New Class1 '°ÊºA°}¦C «Å§i¬°·sªºClass1ª«¥óÃþ§Oª«¥ó

  2. Private Sub ComboBox1_Change()

  3. End Sub

  4. Private Sub CommandButton1_Click()
  5.      Dim mycombobox1 As MSForms.ComboBox

  6.     Dim Sh As Worksheet
  7.      Set Sh = ActiveSheet

  8.     kk = 1

  9.     For sjy = 1 To 400 Step 100

  10.         For sja = 1 To 800 Step 100

  11.             With Frame1.Controls.Add("forms.combobox.1")
  12.                 Sh.Cells(kk, 3) = .Name
  13.                 .Left = 10 + sja
  14.                 .Top = 10 + sjy
  15.                 .Width = 90
  16.                 .Height = 20

  17.                 .TextAlign = fmTextAlignCenter

  18.                 .BackColor = &HFFFFC0

  19.                 '.a = Sh.Cells(kk, 1)
  20.                  ReDim Preserve thecombobox(0 To kk - 1)              '­«·s°t¸m °ÊºA°}¦C
  21.                 Set thecombobox(kk - 1).xlcombobox = Controls(.Name)
  22.                 '°ÊºA°}¦Cªº¤¸¯À «ü©w¨ìª«¥ó¼Ò²Õ¤ºªºª«¥ó
  23.             For ewk = 1 To 32
  24.                  eee = Cells(ewk, 5)
  25.                 thecombobox(kk - 1).xlcombobox.AddItem (eee)
  26.             Next
  27.             End With

  28.             kk = kk + 1

  29.         Next

  30.     Next

  31. End Sub

  32. Private Sub UserForm_Click()

  33. End Sub
½Æ»s¥N½X
¦Û³Ðcheckbox®Ö¿ï §¹¦¨ª©5 ¤U©Ô´ú¸Õ.rar (26.84 KB) ¦Û³Ðcheckbox®Ö¿ï §¹¦¨ª©5 ¤U©Ô´ú¸Õ.rar (26.84 KB)

  ¦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

¦^´_ 3# stillfish00

¶W±j¡AÁÂÁ±zªº¸Ñ´b!!
´ú¸Õok!!

TOP

¦^´_ 1# lichang
  1.     Dim ar
  2.     '¦³´X­Ó¶ñ´X­Ó
  3.     ar = Array("aiSV4", _
  4.                 "aiSV20", _
  5.                 "aiSV40", _
  6.                 "aiSV80", _
  7.                 "aiSV160")
  8.                     
  9.     'combobox1 to combobox20
  10.     For i = 1 To 20
  11.         Controls("ComboBox" & i).List = ar
  12.     Next
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

§â¥i¥H³W«h¤Æªº³¡¤À©î¶}¨Ó¥Î For ¨ú¥N

ex
ComboBox1.AddItem "aiSV20/20"    '----------------9
ComboBox1.AddItem "aiSV20/40"   '----------------10
ComboBox1.AddItem "aiSV40/40"   '----------------11
ComboBox1.AddItem "aiSV40/80"   '----------------12
ComboBox1.AddItem "aiSV80/80"   '----------------13
ComboBox1.AddItem "aiSV80/160"   '----------------14
ComboBox1.AddItem "aiSV160/160"  '----------------15

for w = 20  to 140 Step 20
ComboBox1.AddItem "aiSV" &  w &  "/"  & w   
ComboBox1.AddItem "aiSV" &  w &  "/"  & (w  *2  )
next

TOP

        ÀR«ä¦Û¦b : §g¤l¦p¤ô¡AÀH¤è´N¶ê¡AµL³B¤£¦Û¦b¡C
ªð¦^¦Cªí ¤W¤@¥DÃD