【发布时间】:2016-03-11 14:44:06
【问题描述】:
我正在尝试在我的 VBA 中输入一个 SUMIF 公式,但单元格的范围可能会根据另一个选项卡上的“Lastrow”而改变。我能够得到 Lastrow 没问题,但问题是试图输入我的 SUMIF 公式。 'Lastrow' 值应替换单元格 Q156 和 H156。希望这是有道理的。欢迎提出任何建议。
见下文:
Sub UpdateReconData()
Dim Lastrow6 As Integer
'gets last Row on Formatting Spreadsheet
Sheets("Formatting").Select
Lastrow6 = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Sheets("Recon").Select
Range("B2").Select
ActiveCell.Value = _
"=SUMIF(Formatting!$Q$2:$Q$156(Recon!$A2&Recon!B$1),Formatting!$H$2:$H$156)"
End Sub
【问题讨论】:
-
除非您在 criteria_range 和 criteria_value i>.