- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-12-18
|
¥»©«³Ì«á¥Ñ samwang ©ó 2021-8-24 08:09 ½s¿è
¦^´_ 7# ziv976688
¥H¦U¸ê®Æ§¨¦WºÙªº²Ä5¬q¼Æ¦r¬°°ò·Ç(EX¡G7C _0_1878´Á_100_1877-10_1¦¸)~¥Ñ¤j¦Ó¤p¶}±Òªºµ{¦¡½X¡F
µM«á±N¦U¶}±Ò«áªº¸ê®Æ§¨¤¤¦³ÃöÁä¦r"¾÷"ªºÀÉ®×(EX¡G7C¾÷_1878´Á_100_1877-10_1¦¸)¶}±Ò~
¦A±N¸Ó¶}±Ò«áªºÀɮפº¤§"¾÷²vªí"ªºA&B¤GÄ椺®e½Æ»s«á¡A
¨Ì§Ç¥Ñ¥DÀɤ§"Sheet1!"ªºM1©¹¥k¶K¤W¡C
>> µ{¦¡¦p¤U¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Private Sub CommandButton1_Click()
Dim Path$, a, Ar(1 To 1000, 1 To 2), Ar1()
Nrange = "1878" ' InputBox("½Ð¿é¤JDATA!ªº¶}¼ú´Á¼Æ", "¿é¤J´Á¼Æ")
Tm = Timer
[L1] = ""
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set fs = CreateObject("Scripting.FileSystemObject")
a = ThisWorkbook.Path '¨CÓ¸ê®Æ§¨¦WºÙ¸Ë¤JAr
Set f = fs.GetFolder(a)
Set fc = f.SubFolders
For Each f1 In fc
n = n + 1
Ar(n, 1) = f1.Path
Ar(n, 2) = Split(Split(f1.Name, "_")(4), "-")(0)
Next
For i = 1 To UBound(Ar) 'Ar¥Ñ¤j¦Ü¤p±Æ§Ç
For j = i + 1 To UBound(Ar)
If Ar(i, 2) < Ar(j, 2) Then
a = Ar(i, 1)
Ar(i, 1) = Ar(j, 1)
Ar(j, 1) = a
End If
Next j
Next i
For i = 1 To n '¶}±ÒAr¡A§äÀɦW¦³"¾÷"¸Ë¤JAr1
Set f = fs.GetFolder(Ar(i, 1))
Set fc = f.Files
For Each f1 In fc
If InStr(f1.Path, "¾÷") Then
ReDim Preserve Ar1(n1)
Ar1(n1) = f1.Path
n1 = n1 + 1
End If
Next f1
Next i
fileOrg = ActiveWorkbook.Name
C = 13
If n1 > 0 Then
For i1 = 0 To n - 1 '¶}±ÒAr1¡Acopy A¡BBÄæ¸ê®Æ¨ìSheet1 MÄæ¶}©l©¹¥k
Set WB = Workbooks.Open(Ar1(i1))
With Sheets(1)
If .FilterMode Then .ShowAllData
.Range("a1:b" & .[a65536].End(3).Row).Copy Workbooks(fileOrg).Sheets("Sheet1").Cells(1, C)
C = C + 2
End With
WB.Close
Next
End If
Set fs = Nothing: Set f = Nothing: Set fc = Nothing
With Sheets("Sheet1")
.[A1] = Nrange
...
... |
|