B
bumiblumi
Hi all,
I have a problem with a macro to add a new row and copy formulas.
I use the same macro but in different workbooks, the result on formulas is
different.
for 1st time, result is the same for both workbooks:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseFees)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseFees)
[C8] =SUM(C$6:C7)
but when trying further, there is a difference:
in one workbook:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseFees)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseFees)
[C8] =SUM(C$6:C7)
[C9] =SUM(C$6:C8)
in second workbook:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseCost)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseCost)
[C8] =SUMIF(CourseCodes,Enrolment!B8,CourseCost)
[C9] =SUM(C$6:C8)
I need the effect as in the second workbook, but I don't know how to change
the first one. I can't understand what makes the difference, can anyone help
me please?
btw, here is the macro:
Sub Macro3()
'
' Macro3 Macro
'
'
Range("B7").Select
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Range("C6").Select
Selection.AutoFill Destination:=Range("C6:C7"), Type:=xlFillDefault
Range("C6:C7").Select
Range("C8").Select
ActiveCell.FormulaR1C1 = "=SUM(R6C:R[-1]C)"
Range("C9").Select
End Sub
I have a problem with a macro to add a new row and copy formulas.
I use the same macro but in different workbooks, the result on formulas is
different.
for 1st time, result is the same for both workbooks:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseFees)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseFees)
[C8] =SUM(C$6:C7)
but when trying further, there is a difference:
in one workbook:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseFees)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseFees)
[C8] =SUM(C$6:C7)
[C9] =SUM(C$6:C8)
in second workbook:
[C6] =SUMIF(CourseCodes,Enrolment!B6,CourseCost)
[C7] =SUMIF(CourseCodes,Enrolment!B7,CourseCost)
[C8] =SUMIF(CourseCodes,Enrolment!B8,CourseCost)
[C9] =SUM(C$6:C8)
I need the effect as in the second workbook, but I don't know how to change
the first one. I can't understand what makes the difference, can anyone help
me please?
btw, here is the macro:
Sub Macro3()
'
' Macro3 Macro
'
'
Range("B7").Select
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Range("C6").Select
Selection.AutoFill Destination:=Range("C6:C7"), Type:=xlFillDefault
Range("C6:C7").Select
Range("C8").Select
ActiveCell.FormulaR1C1 = "=SUM(R6C:R[-1]C)"
Range("C9").Select
End Sub