- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 16# jackyliu
³o¬O¸g¹L§Ú´ú¸Õ¹L OK ªº¡AÁöµM¤º®e¤jP¤@¼Ë¡A
¦ýÁÙ¬O¨Ï¥Î§Úªºµ{¦¡½X¸Õ¸Õ¬Ý¡C
(¤§«e§Ú¥ç´ú¥X§A©Ò»¡ªºª¬ªp¡A¸Õ¸Õ³o°¦¬Ý¬Ý¡A¨ä¤¤¤]±N Debug ªº¹Lµ{¤º®e¥ç¨Ö§@¦¨µùÄÀ)- Option Explicit
- Sub Ex()
- Dim Dk As Object, E As Variant, cts As Integer
- ' Dim Dk As Object, E, cts As Integer
-
- Set Dk = CreateObject("Scripting.dictionary") ' ¦r¨åª«¥ó
-
- ' 1. ±N Sheet1 ªº¸ê®Æ,½Æ»s¨ì Sheet2 ªº A1 ¦ì¸m¶}©l,¨Ì§Ç¼g¤J.
- ' 2. «½Æ©Êªº¸ê®Æ,¤£n¦A«½Æ½Æ»s¨ìSheet2
- ' 3. ¤ñ¸û¤£¥i«½ÆÄæ¦ì:©m¦W,¦a°Ï,©Ê§O,±B«Ã
- For Each E In Sheet1.Range("A1").CurrentRegion.Rows ' ª«¥ó: A1 ©Ò©µ¦ù½d³òªº¦C
- ' E.Value : Variant/Variant(1 to 1, 1 to 6) : ThisWorkbook.Ex
- ' E.Value(1,1) : "©m¦W" : Variant/String : ThisWorkbook.Ex2
- ' E.Value(1,2) : "¦a°Ï" : Variant/String : ThisWorkbook.Ex2
- ' E.Value(1,3) : "©Ê§O" : Variant/String : ThisWorkbook.Ex2
- ' E.Value(1,4) : "±Ð¨|µ{«×" : Variant/String : ThisWorkbook.Ex2
- ' E.Value(1,5) : "±B«Ã" : Variant/String : ThisWorkbook.Ex2
- ' E.Value(1,6) : "¤l¤k" : Variant/String : ThisWorkbook.Ex2
- Dk(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = E.Value
- Next
-
- With Sheet2
- .Cells.Clear
- cts = 1
- For Each E In Dk.KEYS
- ' UBound(Dk(E), 1) : 1 : Long : ThisWorkbook.Ex
- ' UBound(Dk(E), 2) : 6 : Long : ThisWorkbook.Ex
- ' E : "©m¦W¦a°Ï©Ê§O±B«Ã" : Variant/String : ThisWorkbook.Ex2
- ' E : "¤p§õ¥x¥_¤k¤w±B" : Variant/String : ThisWorkbook.Ex2
- ' E : "¤p¼B®ç¶é¨k¤w±B" : Variant/String : ThisWorkbook.Ex2
- .Cells(cts, "A").Resize(1, UBound(Dk(E), 2)).Value = Dk(E) ' Ū¨ú¦r¨åª«¥óªº ITEM (°}¦C)
- cts = cts + 1
- Next
- End With
- End Sub
½Æ»s¥N½X ½Ð§â¥H¤W½Æ»sªºµ{¦¡½X©ñ¤J¨ì ThisWorkbook µ{¦¡½X°Ï¤º°õ¦æ¡C
P.S. ¥Ø«e¦b§ÚªºÀɮפ¤ Module1 °Ï¥ç©ñ¤J¬Û¦Pµ{¦¡½X¤À§O´ú¸Õµ²ªG (Sub ¦WºÙ¤£¦P)¡A
³o¬O¬°¤F¤è«K´ú¸Õ "«¬ºA¤£²Å" °ÝÃD©Ò¦b¤§¬G¡C |
|