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

ListBox À³¥Î

ListBox À³¥Î

ListBox°ÝÃD.zip (14.9 KB)
½Ð°Ýª©¤Wªº°ª¤â,
§Ú§Æ±æ¥i¥H»s§@¤@­Ó¡GListBox±q¤u§@ªí¤W§ì¨ú¦h­ÓÄæ¦ì¸ê®ÆµM«á¦s©ñ¦b¦P¤@¦C¸Ì(¦p¤U),¸Ó¦p¦ó¦bListBox¤WÂI¿ï¨ä¤¤¤@¦C±N"²M³æ¤ºªº²Ä1Äæ¡Ï²Ä2Äæ¸ê®Æ¡@TW-1301001-001 BOOK1,TW-1301001-002 BOOK2,TW-1301001-003 BOOK3¡¨©ñ¸m¨ìTextBox1; ¡¨²M³æ¤ºªº²Ä3ÄæA,B,C¡¨ ©ñ¸m¨ìTextBox2, ¨Ã¥[Á`ª÷ÃB«á©ñ¸m¨ìTextBox3.
¦]¯à¤O¦³­­,¥u¯à°µ¨ì±N²M³æ¤ºªº²Ä1Äæ©ñ¸m¨ìTextBox1(Àɮ׸Ԫþ¥ó¡^, ½Ð°ª¤âÀ°À°¦£.·PÁÂ~

learner

¦^´_ 1# yliu
¸Õ¸Õ¬Ý
  1. Private Const Sh = "DATA" 'Const ³¯­z¦¡ «Å§i±`¼Æ , ¨ä­È¦p¦r­±©Ò¥Ü ("DATA")
  2. Dim D As Object
  3. Private Sub UserForm_Initialize()
  4.     Dim i As Integer
  5.     Set D = CreateObject("Scripting.Dictionary")
  6.     With ListBox1
  7.         .ColumnCount = 4                                      'øó¦ì¼Æ
  8.         .ColumnWidths = "120 pt;80 pt;80 pt;80 pt"            '³]©wÄæ¼e
  9.     End With
  10.     With Sheets(Sh)
  11.         i = 2
  12.         Do While .Cells(i, "A") <> ""
  13.             D(.Cells(i, "A").Value) = ""
  14.             i = i + 1
  15.         Loop
  16.     End With
  17.     With ComboBox1
  18.         .List = D.KEYs
  19.         .Value = .List(0)
  20.     End With
  21. End Sub
  22. Private Sub ComboBox1_Change()
  23.     Dim i As Integer, R As Integer
  24.     ListBox1.Clear
  25.     TextBox1 = ""
  26.     TextBox2 = ""
  27.     TextBox3 = ""
  28.     Set D = CreateObject("Scripting.Dictionary")
  29.     With Sheets(Sh)
  30.         i = 2
  31.         Do While .Cells(i, "A") <> ""
  32.             If .Cells(i, "A") = ComboBox1 Then
  33.                 With ListBox1
  34.                     .AddItem
  35.                     R = .ListCount
  36.                     .List(R - 1, 0) = Sheets(Sh).Cells(i, "B")  '³æ¸¹+§Ç¸¹
  37.                     .List(R - 1, 1) = Sheets(Sh).Cells(i, "C")  '«~¦W
  38.                     .List(R - 1, 2) = Sheets(Sh).Cells(i, "D")  '³W®æ
  39.                     .List(R - 1, 3) = Sheets(Sh).Cells(i, "E")  'ª÷ÃB
  40.                 End With
  41.             End If
  42.             i = i + 1
  43.         Loop
  44.     End With
  45. End Sub
  46. Private Sub ListBox1_Change() '±N¿ï¨úListBoxªº­È©ñ¨ìTextBox
  47.     Dim Ar(1 To 3) As String, i As Integer
  48.     For i = 0 To ListBox1.ListCount - 1
  49.         If ListBox1.Selected(i) = True Then
  50.             Ar(1) = IIf(Ar(1) = "", "", Ar(1) & vbTab) & ListBox1.List(i, 1)    '«~¦W
  51.             Ar(2) = IIf(Ar(2) = "", "", Ar(2) & vbTab) & ListBox1.List(i, 2)    '³W®æ
  52.             Ar(3) = Val(Ar(3)) + Val(ListBox1.List(i, 3))                       'ª÷ÃB
  53.         End If
  54.     Next
  55.     TextBox1 = Ar(1)
  56.     TextBox2 = Ar(2)
  57.     TextBox3 = Ar(3)
  58. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

«D±`·PÁÂ GBKEE .
¥i¥H¨Ï¥Î¤F ,ÁÂÁ§A~
learner

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD