- ©«¤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
|
¦^´_ 13# j88141
¦h¥[¤@¦r¨åª«¥ó- Dim D(1 To 2) As Object
- Private Sub Ex() 'ExcelÀÉ®×(ÀÉ®×2),¥[¤J¤@ÓCommandButton ªºµ{¦¡½X
- Dim SH As Worksheet, Rng As Range, i As Integer
- Dictionary_Ex '°õ¦æ³oÓµ{§Ç
- For Each SH In Sheets 'Sheets :ExcelÀÉ®×(ÀÉ®×2)¤¤ªº¤u§@ªí¶°¦X
- Set Rng = SH.[A3] '½s¸¹
- Do While Rng <> ""
- For i = 4 To SH.UsedRange.Columns.Count
- If D(1).exists(SH.Cells(2, i) & Rng & SH.[A1]) Then '¦r¨åª«¥ó¤¤¦³³o key È
- 'key È-> ¬P´Á & ½s¸¹ & ¦a¦W
- '¬P´Á: Sh.Cells(2,i)
- '½s¸¹: Rng
- '¦a¦W" SH.[A1]
- D(1)(SH.Cells(2, i) & Rng & SH.[A1]).Copy Rng.Cells(1, i).Resize(4)
- Rng.Cells(1, i).Range("a3") = D(2)(SH.Cells(2, i) & Rng & SH.[A1])
- Else
- Rng.Cells(1, i).Resize(4) = ""
- End If
- Next
- Set Rng = Rng.End(xlDown) '¤U¤@Ó¬P´Áªº¦ì¸m
- Loop
- Next
- End Sub
- Private Sub Dictionary_Ex()
- Dim Rng(1 To 3) As Range, i As Integer, a
- Set D(1) = CreateObject("SCRIPTING.DICTIONARY")
- Set D(2) = CreateObject("SCRIPTING.DICTIONARY")
- With Workbooks("ÀÉ®×1.xlsx").Sheets("¤u§@ªí1") 'ì©l¸ê®ÆÀÉ®×¥²¶·¬O¶}±Òªº
- Set Rng(1) = .[A4] '¬P´Á
- Do While Rng(1) <> ""
- Set Rng(2) = Rng(1).Offset(, 1) '½s¸¹
- Do While Not Intersect(Rng(1).MergeArea, Rng(2).Offset(, -1)) Is Nothing
-
- For i = 4 To .UsedRange.Columns.Count
- If Rng(2).Cells(1, i) <> "" Then '
- Set D(1)(Rng(1) & Rng(2) & Rng(2).Cells(3, i)) = Rng(2).Cells(1, i).Resize(4)
- D(2)(Rng(1) & Rng(2) & Rng(2).Cells(3, i)) = .Cells(3, Rng(2).Cells(1, i).Column)
- End If
- Next
- Set Rng(2) = Rng(2).End(xlDown) '¤U¤@Ó½s¸¹ªº¦ì¸m
- Loop
- Set Rng(1) = Rng(1).End(xlDown) '¤U¤@Ó¬P´Áªº¦ì¸m
- Loop
- End With
- End Sub
½Æ»s¥N½X |
|