H
Helixal
I need help to modify the range statement in a macro. As it stands I have
arbitraraly set the range to 400 rows. I want to change it so that the
range of rows ends with the last row containing data in column B.
I recorded the following macro to work to sum columns 4 and 7 up to the
point where the name changes in
collumn 2 based on the following formulas in cols H and I row 2:
H=D2+SUMIF($B$1:B1,B2,$D$11)
I=G2+SUMIF($B$1:B1,B2,$G$1:G1)
Sub Net1()
'
' Net1 Macro
' Macro recorded 5/2/2012 by Allen
'
'
Range("H1").Select
ActiveCell.FormulaR1C1 = "NET QNT."
Range("I1").Select
ActiveCell.FormulaR1C1 = "NET TOT."
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=RC[-4]+SUMIF(R1C2:R[-1]C[-6],RC[-6],R1C4:R[-1]C[-4])"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H400"), Type:=xlFillDefault
Range("H2:H400").Select
Range("I2").Select
ActiveCell.FormulaR1C1 = _
"=RC[-2]+SUMIF(R1C2:R[-1]C[-7],RC[-7],R1C7:R[-1]C[-2])"
Range("I2").Select
Selection.AutoFill Destination:=Range("I2:I400"), Type:=xlFillDefault
Range("I2:I400").Select
End Sub
arbitraraly set the range to 400 rows. I want to change it so that the
range of rows ends with the last row containing data in column B.
I recorded the following macro to work to sum columns 4 and 7 up to the
point where the name changes in
collumn 2 based on the following formulas in cols H and I row 2:
H=D2+SUMIF($B$1:B1,B2,$D$11)
I=G2+SUMIF($B$1:B1,B2,$G$1:G1)
Sub Net1()
'
' Net1 Macro
' Macro recorded 5/2/2012 by Allen
'
'
Range("H1").Select
ActiveCell.FormulaR1C1 = "NET QNT."
Range("I1").Select
ActiveCell.FormulaR1C1 = "NET TOT."
Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=RC[-4]+SUMIF(R1C2:R[-1]C[-6],RC[-6],R1C4:R[-1]C[-4])"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H400"), Type:=xlFillDefault
Range("H2:H400").Select
Range("I2").Select
ActiveCell.FormulaR1C1 = _
"=RC[-2]+SUMIF(R1C2:R[-1]C[-7],RC[-7],R1C7:R[-1]C[-2])"
Range("I2").Select
Selection.AutoFill Destination:=Range("I2:I400"), Type:=xlFillDefault
Range("I2:I400").Select
End Sub