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

[µo°Ý] ½Ð±Ð ListBox1.List ¤§ColumnºÃ°Ý?

[µo°Ý] ½Ð±Ð ListBox1.List ¤§ColumnºÃ°Ý?

½Ð±Ð¤j¤j
        Set d = CreateObject("Scripting.Dictionary")
                  With Sheets("°ò¥»¸ê®Æ")
                      For Each a In .Range(.Cells(2, 4), .Cells(65536, 4).End(xlUp))
                          d(a & "") = Array(a.Value, a.Offset(, -3).Value, a.Offset(, -2).Value)
                      Next
                 End With
       If d.Count = 0 Then Exit Sub
    ListBox1.Visible = True
    ListBox1.List = ?????
1.À³¦p¦ó¼g   ¤~¯à±N  Array(a.Offset(, -3).Value, a.Offset(, -2).Value)¤§¤º®e
   §e²{©óListBox1(columncount=3)¤º¥B¤À¥X3­Ó column
2.cells(1,1)= »Ý­n±o¨ì ListBox1.column(1)¤§Data
   cells(1,2)=  »Ý­n±o¨ìListBox1.column(2)¤§Data
   À³¦p¦ó¼g
3.·íµL¶·ListBox1¦s¦b ¦p¦ó¨ÏListBox1.Visible = False ·ífocus¦b¨ä¥Lcontrols®É
   ÁÂÁ«ü¾É

¦^´_ 1# yangjie
¸Õ¸Õ¬Ý
  1. Private Sub ListBox1_Change()  'ÂI¿ïLISTBOX1
  2. With ListBox1
  3. For i = 1 To 3
  4. Cells(1, i) = .List(.ListIndex, i - 1)
  5. Next
  6. End With
  7. End Sub


  8. Private Sub ListBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)  'Â÷¶}LISTBOX1
  9. ListBox1.Visible = False
  10. End Sub

  11. Private Sub UserForm_Initialize()  'ªí³æªì©l¤Æ
  12.         Set d = CreateObject("Scripting.Dictionary")
  13.                   With Sheets("°ò¥»¸ê®Æ")
  14.                       For Each a In .Range(.Cells(2, 4), .Cells(65536, 4).End(xlUp))
  15.                           d(a & "") = Array(a.Value, a.Offset(, -3).Value, a.Offset(, -2).Value)
  16.                       Next
  17.                  End With
  18.        If d.Count = 0 Then Exit Sub
  19. With ListBox1
  20. .List = Application.Transpose(Application.Transpose(d.items))
  21. .ColumnCount = 3
  22. .Visible = True
  23. End With
  24. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

·P¿E Hsieh ª©¤j
   §¹¥þ¸Ñ¨M°ÝÃD©Ò¦b  Á¤F
1.¾Ç¨ì¤F .List(.ListIndex, i - 1)
2..¾Ç·|  . List = Application.Transpose(Application.Transpose(d.items))
3.½Ð±Ð¦óª¬ªp¤U¥i¥Î. List = d.items ?

TOP

¦^´_ 2# Hsieh

·Q½Ð±Ð³oÃä
.List = Application.Transpose(Application.Transpose(d.items))
¬°¤°»ò­n°µ¨â¦¸ªºÂà¸m¤~¯à¥Î©O?
¬O¤£¬O¸ò°}¦Cªººû«×¦³Ãö??

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD