- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-27 05:56 ½s¿è
¦^´_ 1# j88141
¦Û°Ê¶ñ¤J¨ì¥t¤@ÓexcelÀÉ®×(ÀÉ®×2)ªºThisWorkbookµ{¦¡½X- Option Explicit
- Dim D As Object
- Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
- Dim Rng As Range
- Application.EnableEvents = False
- If Target.Address = "$A$1" Then
- Dictionary_Ex
- Set Rng = Sh.[A2]
- Do While Rng <> ""
- If D.exists((Rng & Target)) Then '¦r¨åª«¥ó¤¤¦³³o key È
- D(Rng & Target).Copy Rng.Offset(, 1).Resize(3)
- Else
- Rng.Offset(, 1).Resize(3) = ""
- End If
- Set Rng = Rng.Offset(, 2) '¦V¥ª²¾°Ê2Äæ
- Loop
- End If
- Application.EnableEvents = True
- End Sub
- Private Sub Dictionary_Ex()
- Dim Rng(1 To 2) As Range, i As Integer, a
- Set D = CreateObject("SCRIPTING.DICTIONARY")
- With Workbooks("Xl0000001.xls").Sheets("¤u§@ªí1") 'ì©l¸ê®ÆÀÉ®×¥²¶·¬O¶}±Òªº
- Set Rng(1) = .[A1] 'AÄ檺¬P´Á¬O¦X¨Ö3¦CªºÀx¦s®æ
- Do While Rng(1) <> ""
- Set Rng(2) = Rng(1).CurrentRegion.Rows(Rng(1).Row & ":" & Rng(1).Row + 2)
- 'CurrentRegion ÄÝ©Ê ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò¡C°ßŪ
- 'Rng(1).Row + 2 : Rng(1)©Ò¦bªº¦C¸¹+ 2
-
- For i = 2 To Rng(2).Columns.Count '¬P´ÁªºÄæ¦ì±q²Ä2Äæ¶}©l¨ì³Ì«á¤@Äæ
- Set D(Rng(1) & Rng(2).Cells(3, i)) = Rng(2).Columns(i)
- 'Rng(1) :¬P´Á , Rng(2).Cells(3, i) :¦a¦W
- Next
- Set Rng(1) = Rng(1).End(xlDown) '¤U¤@Ó¬P´Áªº¦ì¸m
-
- Loop
- End With
- End Sub
½Æ»s¥N½X |
|