Option Explicit
Sub TEST()
Dim xU As Range, xA, N&, xR As Range, V
Set xU = Union([B1:B20], [B23:B32])
For Each xR In xU
If Val(xR) <> 0 Then N = N + 1: V = V + Val(xR)
Next
If N > 0 Then MsgBox V / N: [B36] = V / N
End Sub作者: peter460191 時間: 2024-1-19 10:21