simple problem is killing me

lrneilson

Board Regular
Joined
May 29, 2007
Messages
94
Hi
this is my macro everyday my data grows by a column so tomorrow A81-GNO81
and I have to add this row every day can I automate it so I don't have to edit the marco
every day?? I've put <----trouble spot each place I would like to automate

thanks

lrneilson


Range("A1:A81").Select
Range("A81").Activate
ActiveCell.FormulaR1C1 = "=SUM(R[-80]C:R[-1]C)"
Range("A1:A81").Select
ActiveWindow.ScrollRow = 47
Range("A81").Select
Application.CutCopyMode = False
Selection.Copy
Range("B81:GN81").Select <-----Trouble spot!!!!!!
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False



ActiveWindow.ScrollRow = 1
Range("A1:GO1").Select <-----trouble spot
Range("GO1").Activate
ActiveCell.FormulaR1C1 = "=SUM(RC[-196]:RC[-1])"
Range("A1:GO1").Select
ActiveWindow.ScrollColumn = 183
Range("GO1").Select
Application.CutCopyMode = False
Selection.Copy
Range("GO2:GO81").Select <-----trouble spot
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Use a dynamic NAMED range rather than explicit ranges.
 
Upvote 0
Try this instead:
Code:
Dim lngColumn As Long
lngColumn = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(81, 1), Cells(81, lngColumn)).FormulaR1C1 = "=SUM(R1C:R[-1]C)"
Range(Cells(1, lngColumn + 1), Cells(81, lngColumn + 1)).FormulaR1C1 = "=SUM(RC1:RC[-1])"
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,939
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top