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

¦p¦ó¹F¦¨¨â­Ólistboxªº¤ô¥­±²¶b¦P¨B?

¦p¦ó¹F¦¨¨â­Ólistboxªº¤ô¥­±²¶b¦P¨B?

½Ð°Ý¦U¦ì¤j¤j­Y»Ý­n±N¨â­Ólistboxªº¤ô¥­±²¶b¦P¨Bªº¸Ü, À³¸Ó¦p¦ó¾Þ§@?
ºô¸ô¤W§ä¤F¦n´X­Ó¤è¦¡³£µLªk¥¿±`°õ¦æ, ¬O§_¯à¨ó§UÀ°¤U¦£, ÁÂÁÂ
§Æ±æ¬O¤£ºÞ¾Þ§@listbox1©Î¬Olistbox2ªº¤ô¥­±²¶b³£¯à°÷¦P¨B©ó¥t¤@­Ólistbox
PS. ¤½¥q¬O¨Ï¥Îoffice 2007ªº, ¤]µLªk·s¼Wlistviewªº¥\¯à, ©Ò¥H½Ð©¿²¤listviewªº°µªk, ÁÂÁÂ
test.zip (12.11 KB)

¦^´_ 1# earl
¸Õ¸Õ¬Ý
  1. Dim AR(), Msg As Boolean
  2. Private Sub UserForm_Initialize()
  3.     AR = Array(ListBox1, ListBox2)  '©Ò¦³ListBox
  4.     Set myitem = Range("A1:I4")     '³o¸Ì¦³­×§ï
  5.     Set mydb = Range("A2:I4")
  6.     With AR(0) 'ListBox1
  7.         .ColumnCount = 9
  8.        .RowSource = myitem.Address
  9.     End With
  10.     With AR(1) 'ListBox2
  11.            .ColumnCount = 9
  12.            .RowSource = mydb.Address
  13.     End With
  14. End Sub
  15. Private Sub ListBox1_Click()
  16.     If Msg Then Exit Sub
  17.     Ex ListBox1.ListIndex
  18. End Sub
  19. Private Sub ListBox2_Click()
  20.     If Msg Then Exit Sub
  21.     Ex ListBox2.ListIndex
  22. End Sub
  23. Private Sub Ex(OB As Integer)
  24.     Dim E As Variant
  25.     Msg = True
  26.     For Each E In AR
  27.         E.ListIndex = OB ' ©Ò¦³ListBox ¤ô¥­±²¶b³£¦P¨B
  28.     Next
  29.     Msg = False
  30. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE
§Úı±o¥L»¡ªº¬O ListBox1¤U¤è±²¶b©¹¥kºu°Ê®É
ListBox2¤U¤è±²¶b¤]­n¦V¥k¦P¨Bºu°Ê

³o¼ËÁÙ¦³¸Ñ¶Ü?
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¢°¡D±²¶b²¾°Ê®É¡A¨Ã¤£·|IJ°Ê¨Æ¥ó¡]¤£ª¾¨ä¥¦ª©¥»¬O§_¦³¦¹¨Æ¥ó¡^¡A¦Ó¿ï¨ú(Click) ®É¡A¥u¯àÀË´ú¨ä¸ê®Æ¦æ¦C¦ì¸m¡I
¢±¡D­Y·Q¡e¼ÐÃD¤å¦r¡f»P¡e¸ê®Æ¡f¥ª¥k¦P¨BÅã¥Ü¡A³]©w¨ä ColumnHeads = True §Y¥i¡A¤£¶·¥Î¨ì¨â­ÓListBox
¢²¡D¦pªG¦UÄæ¤å¦r¦r¤¸¼Æ¤£¦h¡A¥H½d¨ÒÀɬ°¨Ò¡A¥u­n³]©w¨ä ColumnWidths ÄÝ©Ê¡A¤]¥Î¤£¨ì¤ô¥­±²¶b¡I

°Ñ¦Ò¦p¤U¤èªk¡G
Set mydb = Range("A2:I4")¡@'ª`·N¡G³o°Ñ·Ó¦ì§}¤£¥i¥]§t¡e¼ÐÃD¦C¡f
With ListBox2
¡@¡@.ColumnCount = 9
¡@¡@.RowSource = mydb.Address
¡@¡@.ColumnHeads = True
¡@¡@.ColumnWidths = "42,42,42,42,42,42,42,42,42"
End With

TOP

GBKEE ¤j¤j, ·PÁ±zªº¸Ñµª, ¦ý»P§Ú·Q­nªº»Ý¨D¤£¦P
§Ú¬O§Æ±æ²¾°Êlistbox1¤U¤è¤ô¥­±²¶b®É, listbox2ªº¤ô¥­±²¶b¤]¯à°÷¦P®É²¾°Ê, ¦p¦Pstillfish00¤j´y­z

­ã´£³¡ªL¤j¤j, ¦]¬°¼ÐÃDÁ`¦@¦³¨â¦C, ©Ò¥H¤~¤£¦Ò¼{¥ÎColumnHeads, ¦Ó±Ä¥Î¨â­Ólistboxµª¨ì§Úªº»Ý²y

TOP

¦^´_ 3# stillfish00
    «¢,§Ú²´ªá¤F¶Ã¸Ñ.VBAªº¥\¤O¦³­­£«.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

GBKEE¤j¤j, À³¸Ó¬O¤p§Ì§Ú´y­zªº¤£¦n
¤£¹LÁÙ¬O·PÁ¤j¤j¼ö¤ßªº¨ó§U

«á¨Ó¤p§Ì¦Û¤v¨Ï¥Î¤@²Õlistbox¨Ï¥ÎColumnHeads, ¦b§â¨â¦C¸ê®ÆªíÃD¦X¦b¤@°_Åã¥Ü©ó¦¹, ´N¤£»Ý­n¥Î¨â­Ólistbox¨Ã¦P¨B±²¶b¤F
¤£µM¤p§Ì§Ú¯uªº·Q¤£¨ì¦P¨B«ç¥Î~«¢

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD