- ©«¤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
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-10-20 12:57 ½s¿è
¦^´_ 1# jomeow
ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«½m²ßVBA°}¦C,½m²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò
Option Explicit
Sub TEST()
Dim Brr, Crr, v&, Q%, i&, j%, R&, c%, M&, A%, K&
K = 2000: Brr = Range([A1], ActiveSheet.UsedRange.Offset(1, 0))
ReDim Crr(1 To UBound(Brr), 1 To UBound(Brr, 2))
For j = 2 To UBound(Brr, 2)
c = c + 1: R = 0: Q = 0
If Brr(2, j) Like "BM *" = False Then Exit For
If Brr(3, j) = "" Then GoTo j01
For i = 3 To UBound(Brr)
v = v + Val(Brr(i, j)): A = A + 1
If Trim(Brr(i + 1, j)) = "" Then Q = 1
If (v = K And A > 1) + (v > K) + (Q = 1 And v > 0) < 0 Then
R = R + 1: Crr(R, c) = v: v = 0: A = 0
End If
If Q = 1 Then Exit For
Next
If M < R Then M = R
j01: Next
If M = 0 Then Exit Sub
[J:Z].ClearContents
[J1].Resize(M, c - 1) = Crr
Erase Brr, Crr
End Sub |
|