TEST_0914.rar (227.47 KB)
±N¤U¦Cªº·j´M¶}±Ò±Æ§Ç~¥H¥Ñ¤p¦Ó¤j(¶¶§Ç)§ï¬°¥Ñ¤j¦Ó¤p(˧Ç)¡C
½Ð°Ý»yªkn¦p¦ó½s¼g¡H
ÁÂÁ¡I
Private Sub CommandButton1_Click()
Dim Path$, xD1, A, Ar(1 To 5000, 1 To 2), Ar1(), Arr, Brr(1 To 7), Crr, xD, T%, i&, j&, k&
Application.DisplayAlerts = False: Application.ScreenUpdating = False
Set xD = CreateObject("Scripting.Dictionary")
Set xD1 = CreateObject("Scripting.Dictionary")
fileOrg = ActiveWorkbook.Name
Tm = Timer
Nrange = InputBox("½Ð¿é¤JDATA!ªº¶}¼ú´Á¼Æ", "¿é¤J´Á¼Æ")
num = "100" 'InputBox("½Ð¿é¤J®ÄªGÀÉA¡JH½Æ»sªº´Á¶Z¼Æ½d³ò", "¿é¤J¶Z´Á¼Æ")
Order = "0" ' InputBox("½Ð¿é¤J¼W¥[ªºÅÞ¿è±ø¥ó±ø¥ó¤§°_¨´§Ç¸¹", "¿é¤J§Ç¸¹(1~99)©Î¤£¼W¥[(«öEnter)")
Ncount = "1" ' InputBox("½Ð¿é¤JÅçÃÒª©ªº³sÄò¦¸¼Æ", "¿é¤J¦¸¼Æ(1~10)")
Sheets("DATA").[L1:L4] = ""
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): xD1(Ar(n, 2)) = 1
Next
For Each Ky In xD1
For x = 1 To n '¶}±ÒAr,§ä¦PÃþ«¬¸ê®Æ§¨¡AÀɦW¦³"¾÷"¸Ë¤JAr1
If Ar(x, 2) = Ky Then
Set f = fs.GetFolder(Ar(x, 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
End If
Next x
C = 13
If n1 > 0 Then
For i1 = 0 To n1 - 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
'................................................................................................................. |