Dim sum1 As Double = Tables("表B.表a").Compute("sum(数据)", "项目明细 = '资产总额'") Dim sum2 As Double = Tables("表B.表a").Compute("sum(数据)", "项目明细 = '负债总额'") Dim sum3 As Double = Tables("表B.表a").Compute("sum(数据)", "项目明细 = '所有者权益'") If sum1 = sum2 + sum3 Then msgbox("平衡") Else msgbox(sum1 - sum2 - sum3) End If