View Full Version : Macro that creates creates a row and paste formulas


mosh
06-27-2008, 03:23 AM
Hello All,

I have a Pivot table that updates every week, but I also have two columns connected to the pivot but if a new row is created as a result of the pivot update, I want a row created to calculate the value.

here is what I have so far, all it does it drags the total values and then drags the formula above the total formula down one;


Range("G22:H22").Select
Selection.Cut Destination:=Range("G23:H23")
Range("G21:H21").Select
Selection.AutoFill Destination:=Range("G21:H22"), Type:=xlFillDefault
Range("G21:H22").Select
End Sub

So when the pivot is updated, If a new value (week ending) date is created then follow the above.

Thanks for your help,

Call_Me_Sam
06-29-2008, 12:35 PM
Mosh, i am confused as to what you are trying to achieve with that code.

Did you record it? Are you asking if the code can adapt to where the new row appears and not be prescribed? sorryrather wooly for a sunday evening

mosh
06-30-2008, 12:39 AM
Mosh, i am confused as to what you are trying to achieve with that code.

Did you record it? Are you asking if the code can adapt to where the new row appears and not be prescribed? sorryrather wooly for a sunday evening

Hi Sam,

I initially recorded it yes. Your on the right lines, If a new row appears then carry on with the code.

Thanks

Call_Me_Sam
06-30-2008, 01:34 AM
Hi Sam,

I initially recorded it yes. Your on the right lines, If a new row appears then carry on with the code.

Thanks

Mosh, is this a formula that cannot actaully be built into the pivot table? Are you using data within the table to calculate a further field? as adding a formula TO the pivot table would be easier.