N = 0: Cx = 0 '換檔後, 變數要歸零
dim xE as range
set xE=[A:A].find("總計",lookat:=xlwhole)
For Each xR In range("A2:A" & xE.row-2)
If xR Like "*_*" Then N = N + 1
If xR = "小計" Then
S1 = xR(1, Cx + 2).Resize(1, N).Address
S2 = xR(1, Cx + 2).Address(0, 0)
Cells(65, Cx + 2).Resize(1, N) = "=IF(MAX(" & S1 & ")=" & S2 & "," & S2 & ","""")"
Cx = Cx + N: N = 0
End If
Next作者: ziv976688 時間: 2020-12-24 12:37