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
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,079
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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])"
 

Watch MrExcel Video

Forum statistics

Threads
1,122,721
Messages
5,597,752
Members
414,171
Latest member
12Rev79

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
Top