LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default insert new row and copy formula

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Row - Copy Formula From The Row Above Phendrena Excel Discussion (Misc queries) 3 August 19th 08 07:18 PM
insert row and copy formula Andy B Excel Discussion (Misc queries) 4 May 29th 07 02:44 PM
Insert Row & Copy Formula redruthann Excel Worksheet Functions 0 March 26th 06 11:51 PM
Automatically insert row and copy formula Wendy Excel Worksheet Functions 5 August 25th 05 06:35 PM
Insert Formula and Copy to other cells [email protected] Excel Discussion (Misc queries) 1 August 12th 05 08:51 PM


All times are GMT +1. The time now is 06:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"