返回列表 上一主題 發帖

[發問] VBA 函數公式無法執行

回復 2# ziv976688


太複雜了, 沒辦法

TOP

回復 2# ziv976688


既用vba, 何須複雜, 將各區段位址取出即可
對角五段區域的最大數-01.rar (12.64 KB)

TOP

回復 6# ziv976688


N = 0: Cx = 0  '換檔後, 變數要歸零
For Each xR In [A2:A60]
    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

TOP

回復 9# ziv976688


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

TOP

        靜思自在 : 【是否發揮了良能?】人間壽命因為短暫,才更顯得珍貴。難得來一趟人間,應問是否為人間發揮了自己的良能,而不要一味求長壽。
返回列表 上一主題