½Ð°Ý¦p¦ó³s±µ¥t¤@ÓÀÉ®×Â^¨ú¸ê®Æ©M±Æ§Ç
©«¤l 27 ¥DÃD 12 ºëµØ 0 ¿n¤À 318 ÂI¦W 311 §@·~¨t²Î Windows ³nÅ骩¥» 7 ¾\ŪÅv 20 ©Ê§O ¨k µù¥U®É¶¡ 2010-7-20 ³Ì«áµn¿ý 2024-12-23
½Ð°Ý¦p¦ó³s±µ¥t¤@ÓÀÉ®×Â^¨ú¸ê®Æ©M±Æ§Ç
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
©«¤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
¦^´_ 1# amu1129 Sub Ex()
Dim AR, d As Object, Rng As Range, E, i%, Sh$, DKey
Set d = CreateObject("Scripting.Dictionary")
With Sheet1
AR = Split(.[B1], ",")
For i = 0 To UBound(AR)
For Each E In .Range("B4", .[B4].End(xlDown))
If .Cells(E.Row, "F") = AR(i) Then
d(E & E.Offset(, 1)) = Array(AR(i), E.Offset(, 1), E.Offset(, 5))
If InStr(Sh, E) = 0 Then Sh = IIf(Sh <> "", Sh & "," & E, E)
End If
Next
Next
End With
i = 2
For Each E In Split(Sh, ",")
On Error GoTo Er
With Sheets(i)
.Cells.Clear
.[B2] = E
.[B4].Resize(, 3) = Array("¤Ø¤o", "½s¸¹", "¼Æ¶q")
For Each DKey In d.keys
If DKey Like E & "*" Then
With .Range("b" & Rows.Count).End(xlUp).Offset(1)
.Resize(, 3) = d(DKey)
.Offset(, -1) = .Row - 4
End With
End If
Next
With .Range("b" & Rows.Count).End(xlUp)
.Offset(1) = "¦Xp"
.Offset(1, 2) = Evaluate("=SUM(" & .Offset(, 2).Address(, , , 1) & ":D5)")
End With
.Range("B4").CurrentRegion.Borders.LineStyle = 1
End With
i = i + 1
Next
Exit Sub
Er:
If Err = 9 Then
Sheets.Add , Sheets(Sheets.Count)
Resume
Else
MsgBox Err
End If
End Sub ½Æ»s¥N½X
©«¤l 27 ¥DÃD 12 ºëµØ 0 ¿n¤À 318 ÂI¦W 311 §@·~¨t²Î Windows ³nÅ骩¥» 7 ¾\ŪÅv 20 ©Ê§O ¨k µù¥U®É¶¡ 2010-7-20 ³Ì«áµn¿ý 2024-12-23
¤£¦n·N«ä~ª©¥D
¨S¦³¤ÏÀ³C
¬OÁÙ»Ýn§ó§ï¤°»ò¶Ü
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
©«¤l 4901 ¥DÃD 44 ºëµØ 24 ¿n¤À 4916 ÂI¦W 276 §@·~¨t²Î Windows 7 ³nÅ骩¥» Office 20xx ¾\ŪÅv 150 ©Ê§O ¨k ¨Ó¦Û ¥x¥_ µù¥U®É¶¡ 2010-4-30 ³Ì«áµn¿ý 2024-12-22
¦^´_ 3# amu1129
¦bBOOK1¸òBOOK2ªºSheet1¼Ò²Õ¤º¿é¤Jµ{¦¡½X
§ïÅÜBOOK1¸òBOOK2ªºSheet1ªºb2Àx¦s®æ¸Õ¸ÕPrivate Sub Worksheet_Change(ByVal Target As Range)
Dim Ar(), Ay(), A As Range
Ky = Array("B01", "B02", "A01", "A02")
If Target.Address <> "$B$2" Then Exit Sub
fs = ThisWorkbook.Path & "\5 B01,B02,A01,A02.xls"
ReDim Preserve Ay(k)
Ay(k) = Array("", "¤Ø¤o", "½s¸¹", "¼Æ¶q")
k = k + 1
With Workbooks.Open(fs)
With .Sheets(1)
For Each A In .Range(.[B4], .[B65536].End(xlUp))
If A = Target Then
ReDim Preserve Ar(s)
Ar(s) = Array(A.Offset(, 4).Value, A.Offset(, 1).Value, A.Offset(, 5).Value)
cnt = cnt + A.Offset(, 5).Value
s = s + 1
End If
Next
End With
.Close 0
End With
For i = 0 To 3
For j = 0 To UBound(Ar)
If Ar(j)(0) = Ky(i) Then
ReDim Preserve Ay(k)
Ay(k) = Array(k, Ar(j)(0), Ar(j)(1), Ar(j)(2))
k = k + 1
End If
Next
Next
ReDim Preserve Ay(k)
Ay(k) = Array("", "¦Xp", "", cnt)
k = k + 1
With Me
.[A3:D65536].Clear
.[A4].Resize(k, 4).Value = Application.Transpose(Application.Transpose(Ay))
.Range("A2").Resize(k + 2, 4).Borders.LineStyle = 1
.Range("A2").Resize(k + 2, 4).Borders.Weight = xlThin
.Range("B2").Resize(k + 2, 3).BorderAround 1, xlThick, xlColorIndexAutomatic
End With
End Sub ½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý
©«¤l 27 ¥DÃD 12 ºëµØ 0 ¿n¤À 318 ÂI¦W 311 §@·~¨t²Î Windows ³nÅ骩¥» 7 ¾\ŪÅv 20 ©Ê§O ¨k µù¥U®É¶¡ 2010-7-20 ³Ì«áµn¿ý 2024-12-23
[ª©¥DºÞ²z¯d¨¥] Hsieh(2010-9-2 22:41): ¥H¦³§Þ¥©¦s¦b¡A¦ó¤£¦Û¤v°Ê¤â°µ°µ¬Ý?
¤£¦n·N«ä~¤£ª¾¹D¬°¤°»ò´N¬O¤£·|¶]
¦pªG§Ú·Q§ï¦¨¦p¤U¹Ï
µ{¦¡¤@
¤@¶}©l¬°½s¸¹1¹Ï
±µµÛ¦bÀx¦s®æB2¿é¤J
·|¶]¥X¦p½s¸¹2¹Ï
µ{¦¡¤G
¦bFÄ櫽ƽs¸¹¤U¶K¤W«½Æ½s¸¹(½s¸¹3¹Ï)
·|¦Û°Ê±N«½Æªº½s¸¹µ¹§R°£
±µµÛ¤~¶]¥X¤U±¼Æ¶qªº¦Xp
³Ì«á¥H®Ø½u°_¨Ó
³Â·Ð½ÐÀ°§Úקï¤@¤U~ÁÂÁÂ
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X
©«¤l 1447 ¥DÃD 40 ºëµØ 0 ¿n¤À 1471 ÂI¦W 0 §@·~¨t²Î Windows 7 ³nÅ骩¥» Excel 2010 & 2016 ¾\ŪÅv 50 ©Ê§O ¨k ¨Ó¦Û ¥xÆW µù¥U®É¶¡ 2020-7-15 ³Ì«áµn¿ý 2024-12-5
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, Crr(1 To 1000, 1 To 250), Z, B, v&, i&, R&, C%, x%, u&, T5$, T1$
[I:IV].Delete
Set Z = CreateObject("Scripting.Dictionary")
Brr = Range([Sheet1!G4], [Sheet1!B65536].End(xlUp))
For Each B In Split([B1], ",")
i = i + 1: Z("/" & B & "/") = i
Next
For i = 1 To UBound(Brr)
T1 = Brr(i, 1): T5 = Brr(i, 5)
If Z("/" & T5 & "/") = "" Then GoTo i01
B = Z(T1)
R = Z(T1 & "/r") + 1
If Not IsArray(B) Then
B = Crr
x = x + 1
Z(T1 & "/c") = x
Z(T1 & "/r") = 1
End If
B(R, 1) = Z("/" & T5 & "/")
B(R, 2) = T5
B(R, 3) = Brr(i, 2)
B(R, 4) = Val(Brr(i, 6))
Z(T1 & "/r") = R
Z(T1) = B
i01: Next
For Each B In Z.KEYS
If Not IsArray(Z(B)) Then GoTo v01
u = Z(B & "/c")
v = Z(B & "/r")
With Cells(1, (u - 1) * 5 + 9).Resize(v + 2, 4)
.Item(1) = "§Ç¸¹ \ " & B
.Item(2) = "¤Ø¤o"
.Item(3) = "½s¸¹"
.Item(4) = "¼Æ¶q"
.Item(2, 1).Resize(v, 4).Value = Z(B)
.Sort KEY1:=.Item(1), Order1:=1, _
Key2:=.Item(3), Order2:=1, Header:=1
With .Item(2, 1).Resize(v)
.Value = "=ROW(" & .Address(0, 0) & ")-1"
End With
.Item(v + 2, 2) = "¦Xp"
.Item(v + 2, 4) = "=SUM(" & .Item(2, 4).Resize(v).Address & ")"
.EntireColumn.AutoFit
.Borders.LineStyle = 1
End With
v01: Next
Set Z = Nothing: Erase Brr, Crr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y