- ©«¤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
|
¦^´_ 31# jackson7015 - Option Explicit
- Sub Ex()
- Dim E As Variant, wbSh(1 To 2) As Worksheet, bNFind(1 To 2) As Boolean
- Dim AR(1 To 2), xPath As String, Rng As Range
- AR(1) = "¥þ¦~«×¸ê®Æ®w.xls" 'ÀɮצWºÙ
- AR(2) = "·í¤ë³øªí.xls" 'ÀɮצWºÙ
- xPath = "D:\" 'Àɮתº¸ô®|
- For Each E In Workbooks '©Ò¦³¶}±Òªº¬¡¶Ã¯ª«¥ó¶°¦X
- If E.Name = AR(1) Then bNFind(1) = True '¥þ¦~«×¸ê®Æ®w ¤w¶}±Ò
- If E.Name = AR(2) Then bNFind(2) = True '·í¤ë³øªí ¤w¶}±Ò
- Next
- For E = 1 To UBound(bNFind)
- If Not bNFind(E) Then 'ÀÉ®×¥¼¶}±Ò
- Workbooks.Open (xPath & AR(E))
- End If
- Set wbSh(E) = Workbooks(AR(E)).Sheets("ºî¦X¸ê®Æ®w")
- Next
- With wbSh(2) '·í¤ë³øªí"¤¤ªº[ºî¦X¸ê®Æ®w]
- '***1.¦]AQ¦³®ÉÔ·|¨S¦³³]©wÈ¡A©Ò¥H¯à§_¥u§PÂ_A¦C¦³´X¦æ¡AµM«á½Æ»sA5:AQ(A¦C³Ì«á¤@¦æ)
- 'Set Rng = .Cells(.Rows.Count, .[AQ1].Column).End(xlUp) ' §ä¥½¦C
- Set Rng = .Cells(.Rows.Count, "AQ").End(xlUp) ' §ä¥½¦C
- If .[A5].End(xlDown).Row > Rng.Row Then
- Set Rng = .Range(.[A5], .Range("AQ" & .[A5].End(xlDown).Row))
- Else
- Set Rng = .Range(.[A5], Rng)
- End If
- End With
- With wbSh(1) '¥þ¦~«×¸ê®Æ®w"¸ê®Æªíªº[ºî¦X¸ê®Æ®w]
- Rng.Copy .Cells(.Rows.Count, 1).End(xlUp).Offset(1)
- '***3.¥u¶K¤W"È"ªº³¡¤À´N¦n
- .UsedRange = .UsedRange.Value
- End With
- '***2.¥uÀx¦sÃö³¬"¥þ¦~«×¸ê®Æ®w"
- Workbooks(AR(1)).Close True '¥þ¦~«×¸ê®Æ®w. Ãö³¬¥B¦sÀÉ
- End Sub
½Æ»s¥N½X |
|