- ©«¤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
        
|
¦^´_ 5# iceandy6150
VBAªº¥i¥Î¤£¦Pªº¼gªk,¨Ó¹F¨ì¦P¤@®ÄªG- Option Explicit
- Private Sub CommandButton1_Click()
- Dim Rng() As Range, Ar(), xR As Variant, xC As Variant, i As Integer, ii As Integer
- Dim xRng As Range
- Application.ScreenUpdating = False
- Ar = Array("´ú¸Õ.XLSM", "¤Ø¤o.XLSX", "¸ê®Æ.XLSX")
- ReDim Rng(UBound(Ar)) '** Rng «¸m¤¸¯À»P Ar ¤@¼Ë¦h
- For i = 0 To UBound(Ar)
- '**Workbooks(Ar(0)).Path ** קאּ ¤Ø¤o , ¸ê®Æ Àɮתº¥¿½T¸ê®Æ§¨¦ì¸m**
- If i > 0 Then Workbooks.Open (Workbooks(Ar(0)).Path & "\" & Ar(i)) '**¶}±ÒÀÉ®×
- With Workbooks(Ar(i))
- Set Rng(i) = .Sheets(1).Range("A1").CurrentRegion '**³]©wÓÀɮתº¸ê®Æ½d³ò
- End With
- Next
- With Rng(0) '**´ú¸Õ.XLSM ²M°£n¾É¤J¸ê®Æªº½d³ò
- .Range(.Cells(2, 2), .Cells(.Rows.Count, .Columns.Count)) = ""
- End With
- Set xRng = Rng(0).Cells(2, 1) '**´ú¸Õ.XLSM: ²Ä¤@Ó ¾Ç¸¹
- Ar = Rng(0) '**´ú¸Õ.XLSM: ½d³ò¸ê®Æ¾É¤J°}¦C
- Do While xRng <> "" '°j°é: ¾Ç¸¹ªº·j´M
- For ii = 1 To UBound(Rng)
- xR = Application.Match(xRng, Rng(ii).Columns(1), 0) '¤Ø¤o,¸ê®Æ ¤¤·j´M ¾Ç¸¹(ªº¦C¸¹)
- If Not IsError(xR) Then '**·j´M¨ì ¾Ç¸¹(ªº¦C¸¹)
- For i = 2 To Rng(0).Rows(1).Cells.Count '**´ú¸Õ Äæ¦ì¦WºÙ
- '**xC ¶Ç¦^¬O§_·j´M¨ì Äæ¦ì¦WºÙ
- xC = Application.Match(Rng(0).Cells(1, i), Rng(ii).Rows(1).Cells, 0)
- If Not IsError(xC) Then Ar(xRng.Row, i) = Rng(ii).Cells(xR, xC) '**¾É¤J¸ê®Æ¨ì°}¦C
- Next
- End If
- Next
- Set xRng = xRng.Offset(1) '**´ú¸Õ.XLSM: ¤U¤@Ó ¾Ç¸¹
- Loop
- For i = 1 To UBound(Rng)
- Rng(i).Parent.Parent.Close '**Ãö³¬ "¤Ø¤o.XLSX", "¸ê®Æ.XLSX"
- Next
- Rng(0) = Ar '**°}¦C¸ê®Æ¾É¤J´ú¸Õ.XLSMªº½d³ò
- Application.ScreenUpdating = True
- End Sub
½Æ»s¥N½X |
|