Bad_Handle
New Member
- Joined
- Nov 12, 2009
- Messages
- 26
Hello, <o></o>
<o></o>
Can someone please help with the syntax to use VBA for including FinalRow value in a SUMIF formula? Hope this is on the right track. The goal is to keep the formula available in the cell after running the macro.<o></o>
<o>
</o>
<o></o>
'Determine Last Row of Imported Dataset<o></o>
Dim FinalRow As Long<o></o>
FinalRow = Range("A1048576").End(xlUp).Row<o></o>
<o></o>
'Cell to Change: H10 <o></o>
'Change SumIf Formulas to include final row of Data instead of Row 20000<o></o>
'Original --> Range("H10").FormulaR1C1 = "=SUMIF(R14C17:R20000C17,R10C1,R14C:R20000C)"<o></o>
<o></o>
Range("H10").FormulaR1C1 = "=SUMIF(R14C17:R[FinalRow]C17,R10C1,R14C:R[FinalRow]C)"<o></o>
<o></o>
Can someone please help with the syntax to use VBA for including FinalRow value in a SUMIF formula? Hope this is on the right track. The goal is to keep the formula available in the cell after running the macro.<o></o>
<o>
</o>
<o></o>
'Determine Last Row of Imported Dataset<o></o>
Dim FinalRow As Long<o></o>
FinalRow = Range("A1048576").End(xlUp).Row<o></o>
<o></o>
'Cell to Change: H10 <o></o>
'Change SumIf Formulas to include final row of Data instead of Row 20000<o></o>
'Original --> Range("H10").FormulaR1C1 = "=SUMIF(R14C17:R20000C17,R10C1,R14C:R20000C)"<o></o>
<o></o>
Range("H10").FormulaR1C1 = "=SUMIF(R14C17:R[FinalRow]C17,R10C1,R14C:R[FinalRow]C)"<o></o>