- ©«¤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
|
¦^´_ 7# ziv976688
Á`¦¸¼Æªº¤T¤p¦³2Ó~21©M40(¤¤¦¡±Æ¦W~"¦P¦W¦¸" >=1ӮɡA³£n°O¿ý)
W91 ¨S¦³°O¿ý¨ì
>> ¦]¬°«e3¤j¤p¦³«½ÆÈ¡A©Ò¥H¤À¶}²Îp¤ñ¹ï¸ê®Æ¡A§ó·s¦p¤U¡A½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Private Sub CommandButton1_Click()
Dim Path As String, A, Ar(1 To 1000, 1 To 2), Ar1(), Arr, Brr(1 To 7), Crr, xD, T%, i&, j&
Dim Drr(1 To 3, 1 To 49), Arr1, R%, K21%, K22%, K31%, K32%, R21%, R22%, R31%, R32%, T1%
Dim Ar21(1 To 10, 1 To 2), Ar22(1 To 10, 1 To 2), Ar31(1 To 10, 1 To 2), Ar32(1 To 10, 1 To 2)
Set xD = CreateObject("Scripting.Dictionary")
...
...
If n1 > 0 Then
R = 33
ªíÀY = Array("Á`¦¸¼Æ", "³Ì¤j", "¦¸¤j", "¤T¤j", "", "³Ì¤p", "¦¸¤p", "¤T¤p", _
"¿¼Æ", "³Ì¤j", "¦¸¤j", "¤T¤j", "", "³Ì¤p", "¦¸¤p", "¤T¤p")
For i1 = 0 To n - 1 '¶}±ÒAr1
Set WB = Workbooks.Open(Ar1(i1))
fn = Split(Ar1(i1), "_")(5)
With Sheets(1)
If .FilterMode Then .ShowAllData
With .Range(.[B1], .[E65536].End(3))
Crr = .Value
.Sort Key1:=.Item(3), Order1:=2, Header:=1
Arr = .Value 'Á`¦¸¼Æ
.Sort Key1:=.Item(4), Order1:=2, Header:=1
Arr1 = .Value '¿¼Æ
.Value = Crr
End With
End With
WB.Close
For i = 2 To UBound(Arr) 'Á`¦¸¼Æ:³Ì¤j3¼ÆÈ
K21 = K21 + 1: If K21 > 3 And xD(Arr(i, 3) & "_21") <> 1 Then Exit For
Ar21(K21, 1) = Arr(i, 1): Ar21(K21, 2) = Arr(i, 3): xD(Arr(i, 3) & "_21") = 1
Next
For i = UBound(Arr) To 2 Step -1 'Á`¦¸¼Æ:³Ì¤p3¼ÆÈ
K22 = K22 + 1: If K22 > 3 And xD(Arr(i, 3) & "_22") <> 1 Then Exit For
Ar22(K22, 1) = Arr(i, 1): Ar22(K22, 2) = Arr(i, 3): xD(Arr(i, 3) & "_22") = 1
Next
For i = 2 To UBound(Arr1) '¿¼Æ:³Ì¤j3¼ÆÈ
K31 = K31 + 1: If K31 > 3 And xD(Arr1(i, 4) & "_31") <> 1 Then Exit For
Ar31(K31, 1) = Arr1(i, 1): Ar31(K31, 2) = Arr1(i, 4): xD(Arr1(i, 4) & "_31") = 1
Next
For i = UBound(Arr1) To 2 Step -1 '¿¼Æ:³Ì¤p3¼ÆÈ
K32 = K32 + 1: If K32 > 3 And xD(Arr1(i, 4) & "_32") <> 1 Then Exit For
Ar32(K32, 1) = Arr1(i, 1): Ar32(K32, 2) = Arr1(i, 4): xD(Arr1(i, 4) & "_32") = 1
Next
With Sheets("Sheet1")
.Range("a" & R) = fn
.Range("b" & R).Resize(16) = Application.Transpose(ªíÀY)
For i = 1 To K21 - 1 'Á`¦¸¼Æ:³Ì¤j3¼ÆÈ
T = Ar21(i, 2): If T1 = T Then R21 = R21 Else R21 = R21 + 1
Drr(R21, Ar21(i, 1)) = "V": T1 = T
Next
.Range("c" & R + 1).Resize(3, 49) = Drr
R = .[b65536].End(3).Row - 10: Erase Drr: T1 = 0
For i = 1 To K22 - 1 'Á`¦¸¼Æ:³Ì¤p3¼ÆÈ
T = Ar22(i, 2): If T1 = T Then R22 = R22 Else R22 = R22 + 1
Drr(R22, Ar22(i, 1)) = "V": T1 = T
Next
.Range("c" & R).Resize(3, 49) = Drr
R = .[b65536].End(3).Row - 6: Erase Drr: T1 = 0
For i = 1 To K31 - 1 '¿¼Æ:³Ì¤j3¼ÆÈ
T = Ar31(i, 2): If T1 = T Then R31 = R31 Else R31 = R31 + 1
Drr(R31, Ar31(i, 1)) = "V": T1 = T: T1 = 0
Next
.Range("c" & R).Resize(3, 49) = Drr
R = .[b65536].End(3).Row - 2: Erase Drr: T1 = 0
For i = 1 To K32 - 1 '¿¼Æ:³Ì¤p3¼ÆÈ
T = Ar32(i, 2): If T1 = T Then R32 = R32 Else R32 = R32 + 1
Drr(R32, Ar32(i, 1)) = "V": T1 = T: T1 = 0
Next
.Range("c" & R).Resize(3, 49) = Drr
R = .[b65536].End(3).Row + 2: Erase Drr: T1 = 0
End With
Erase Ar21: Erase Ar22: Erase Ar31: Erase Ar32: xD.RemoveAll
K21 = 0: K22 = 0: K31 = 0: K32 = 0: R21 = 0: R22 = 0: R31 = 0: R32 = 0
Next
End If
Set fs = Nothing: Set f = Nothing: Set fc = Nothing
...
... |
|