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

[µo°Ý] listbox rowsource¥Îªk

[µo°Ý] listbox rowsource¥Îªk

¥»©«³Ì«á¥Ñ wang077 ©ó 2021-7-16 08:47 ½s¿è

¦U¦ì¤j¯«­Ì
½d¨Ò.JPG
¦p¹Ï¡A§Ú¦pªG¤£­nEÄæ¡A¸Ó«ç»ò­×§ï¡AµM«á¦³¿ìªk¤£­nªÅ¥ÕÀx¦s®æ¶Ü¡A¦]¬°§Ú¦³¦X¨ÖÀx¦s®æ¡A¥L·|§ì¨ìªÅ¥Õªº
  1. With ListBox1
  2. Set Rng = Worksheets("Sheet1").Range("D2:D100", "F2:F100")
  3. .RowSource = Rng.Address
  4. End With
½Æ»s¥N½X
³o¬O§Ú¼gªºµ{¦¡½X

¦^´_ 1# wang077
¦³¤H¦³·Qªk¶Ü
:'(

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2021-7-17 02:19 ½s¿è

¦^´_ 2# wang077


¸j­ì©l¸ê®Æ¨Ó·½
´N¬O§e²{¸ê®Æ¨Ó·½

¦pªG­n¤£¦Pªº¸ê®Æ§e²{
³Ð­Ó·sªº¼È¦s¤u§@ªí
§â­nªº¸ê®Æ¶K¦b¨º±iªí¤W
¦b¥ÎListBox¥h³sµ²·sªí

§_«h©ïÀY·|³Q¤Á

¥t¥~ §Ú¨S¦³¸Õ¹L¥Î°}¦C¸j
¦pªG³Ðªí¤£³ßÅw
¥i¥H¸ÕµÛ¸j°}¦C¬Ý¬Ý
¦ý¤£½T©w §Ú¨S¸j¹L

¦ý§Ú¦L¶H³o­Ó¦n¹³¬O¥Î°j°é+§PÂ_ µM«á add ¤@µ§¤@µ§¥[ªº?

TOP

¦^´_ 1# wang077


¸ê®Æ¥i¥ý¸Ë¤J¼Æ²Õ¡A¦A±q¼Æ²Õ´`Àô±NªÅ¥Õ±Æ°£´N¥i¥H¤F¡AÁÂÁ¡C

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2021-7-17 15:11 ½s¿è

¦^´_ 1# wang077


RowSource ¤£¯à¨Ï¥ÎÂ÷´²½d³ò¡A¥u¯à¬O³sÄò½d³ò¡A³q±`¬O¼gSQL»yªkª½±µ³sµ²¨ì¬Y¸ê®Æ®w

­n¨Ï¥Î  RowSource ¥u¯à§â§A­ì¥»ªºªí ¸g¹L¾ã²z(±Æ°£ªÅ¥Õ)¡A¿é¥X¨ì¥t¤@­Óªí¡A¨Ï¨äÅܦ¨³sÄò½d³ò¤~¯à¤Þ¥Î

¤W­±³o¤@¨B¼g°_¨Ó¤Ï¦Ó"Ácº¾"¡A©Ò¥H§Ú³q±`¤£·|³o¼Ë°µ¡A§Ú²ßºD¥Î "List" ÄÝ©Ê ½á¤©°}¦C­È

ª½±µ§ï¼g§A­ì¥»µ{¦¡¦p¤U¡A½Ð¸Õ¬Ý¬Ý~


For Each Rg In [Sheet1!D2:D100,Sheet1!F2:F100].SpecialCells(2)
  xList = xList & " " & Rg
Next
ListBox1.List = Split(Mid(xList, 2))
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 1# wang077


¶¶«KªÈ¥¿§A½d³òªº¼gªk¡A¥H¤U½d³ò·|§t"EÄæ"

Set Rng = Worksheets("Sheet1").Range("D2:D100", "F2:F100")

¦pªG§A"¤£­nEÄæ"¡A­n³o¼Ë¼g¡A¥J²Ó¬Ý¡A¤£¤@¼Ëªº³á

Set Rng = Worksheets("Sheet1").Range("D2:D100, F2:F100")
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2021-7-17 16:17 ½s¿è

¦^´_ 3# singo1232001

©êºp!¤µ¤Ñª±¤F¤@¤U
    ¸É¥R ¨Ã­×¥¿ §Ú¦Û¤v»¡¹Lªº³¡¤À

listbox¶×¤J¸ê®Æ®É ¤À¦¨¨âºØ¤è¦¡
1    RowSource¸j©wôµ²¤è¦¡ ¥u­n¥Î¤WRowSource¤§«á listbox ¤º¤¤ªº¥ô¦ó¸ê®Æ ,µLªk¦A°µÅܧó,°ßŪ¼Ò¦¡
1.0 ¯}¸Ñ¤p§Þ¥©:¥i·s³Ð¤@­ÓÁôÂäu§@ªí·í§@listbox¼È¦s°Ï ,¥u­n±N¸ê®Æ¾ã²z¸¹©ñ¤J·s¤u§@ªí§Y¥i(³Ì±ÀÂˤS³Ì§Öªº°µªk)
1.1 ­Y­ì¥»³Q¸j©wªº¤u§@ªí½d³ò¤º¸ê®Æ¦³¥ô¦óÅÜ°Ê listbox¤ºªº¸ê®Æ ·|¦P¨BÅÜ°Ê(©Ò¥H·Q§ïlistbox¤ºªº¸ê®Æ ´N­n¥h§ï¼È¦s¥Îªº¤u§@ªí)
1.2 ¸j©w¤u§@ªí½d³ò ¥²©w¬Û³s ¤£¥i¤À³Î ¤£¥i³æ¿ï ¤£¥iunion
1.3 ¤£¥iadditem ¤£¥iremoveitem
1.4 ¼ÐÀY¤£¥Î¦C¤J½d³ò¤º ¥u­nRowSource¸j¤U¤@¦C «áÄò¥[¤W ListBox1.ColumnHeads = True ²Ä¤@¦Cªº¼ÐÀY´N·|²£¥Í

2     .additem¸ê®Æ³vµ§¶×¤J¤è¦¡
2.1 ­ì©l¸ê®Æ»Plistbox¤ºªº¸ê®Æ¤£¦P¨B ­þÃäÅܰʳ£¤£¼vÅT¥t¤@Ãä
2.2 ¨C¦C³£¥²¶·¥ý.additem ¤~¥i§Q¥Îlist ©ñ¤J¸ê®Æ ¸ê®Æ¥i±q¥ô¦óÃþ«¬¶×¤J ¤u§@ªí,°}¦C,¥~³¡¸ê®Æ®w
       (¤]¥i¥H¤£¥Î°j°é,ª½±µ¾ã±i°}¦C¤@¦¸¶×¤J)
2.3  ¥²¶·¥Î.ColumnCount = 4  ¥h³Ð³yÄæ¦ì (4¬°Äæ¦ì¼Æ¶q)
2.4  ¥²¶·¥Î.ColumnWidths = "20,20,20,20"     '³]¸m¨C­ÓÄæ¦ì¼Æ¼e«× 20¬°¼e«×pt
2.5  .RowSource = True ¼ÐÀY¥i¥H¥t¥~²K¥[ ¦ýµLªkÅܧó©ïÀY ´N«ÜµL©`¬O­ÓªÅ¥Õ
2.6  ¥t¥~¥Î¦UºØ±±¥ó§ï¸Ë¼ÐÀY ¤]·|¸I¤W¸ê®Æ¶q¦hªº®É­Ô ¤ô¥­ºu½ü ¤£·|¸òµÛ¤@°_¼vÅT§ï¸Ë¼ÐÀYªº¤ô¥­¾î²¾(·Pıoffice§¹¥þ¤£·Q²z³o¥ó¨Æ±¡¤F)
       ·Q·íµM ¦pªG¸ê®Æ¤£·|¤Óªø ¶W¹L¤ô¥­¼e«× ·íµM´N¨S°ÝÃD¯à²n¥Î

3     ListView
3.1 Å¥»¡«Ü¦n¥Î(¥Ø«eÁÙ¦b¾Ç,¦³¾Ç¤F¦ý¤£¬O«Ü¼ô)
3.2  »P·sª©excel2016 2019­Ý®e¦ý»Ý¤â°Ê¦w¸Ë ¥H«e¬O¦Û°Ê­Ý®e
        (¤]¥i¯à§ÚÁ¿¤Ï ¥i¯à¬O2003 2007 ¤£¤ä´© ­nÃB¥~¤U¸ü¦w¸Ë¥])
        (¦ý¦n¹³¤]¦³»¡¬O32¦ì¤¸ªºofficeµLªk¦w¸Ë) ¶iexcel>ÀÉ®×>±b¤á>Ãö©óexcel ¸Ì­±¦³¦ì¤¸
        ©çÁµLªk½T©w
3.3  ¥²¶·¦bÀɮפº¼g¤@½g ¦p¦ó¤â°Ê¦w¸Ë±±¥óªº»¡©ú ©ÎªÌ½Ð¤H¤Wºô¬d ¨C´«¥x¹q¸£³£»Ý­n­«·s³]©w¤@¦¸
3.4  ºÉ¶q¼g¥X ±±¥ó¥¢±ÑªºÄµ§i´£¥Ü¼Ò²Õ ÁקK¤£ª¾ªÌ ¦b¨S¦w¸Ëªº±¡ªp¤U¶}±Ò ¨ì®É­Ô¶}µoªÌ´N·|¶O®É¶O¤OÅÜ­Þ¤jÀY


¶¶«K°Q½×¾ã²z»`¶°¨ìªº¸ê°T
¦³¿ù·Ð½ÐªÈ¥¿¤@¤U ÁÂÁ¤j¯«­Ì

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2021-7-17 16:35 ½s¿è

¦^´_ 7# singo1232001


¥t¥~³o¬O¥h¦~ ÁÙ¤£·|"°}¦C" ¸ò "set"¤è¦¡®É¼gªº´ú¸ÕÀÉ
«Ü¶§¬K «Üµæ «Ü¦hbug
¦ý©Î³\¦]¬°«Üª½±µ«Üª½¥Õ ©Î³\¤ñ¸û¦nŪ
±N´NµÛ¬Ý
¦Ó¥B§Úı±o³o¬O¤@­Ó½m²ß"OOPª«¥ó¾É¦V"ªº¦nÃD¥Ø!
¦ý³o¨â¥÷ÀÉ®× §Ú³£¨S¥Î¤WOOP
µwµÛÀY¥Ö¼É¤Ocode

¦p¦ó»s§@listbox·s­×§R«Ê v2.zip (91.2 KB)

¦p¦ó»s§@listbox§R°£´_­ì­×§ï­q³æ.zip (62.79 KB)

TOP

¦^´_ 4# samwang
¤F¸Ñ¡AÁÂÁ¤j¤j

TOP

¦^´_ 5# n7822123
¥i¤j¤j³o¬qµ{¦¡½X¦n¹³¤£¯à°Ï¤À¦¨¨âÄæ
1.jpg
2.jpg

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD