Using VBA to Autosum variable rows

Jaysilva

New Member
Joined
Aug 29, 2015
Messages
3
Hi Basically i download data from my in house system. The Coloumns are always the same they are fixed and go from column A to W. The rows vary with the amount of data. I need to autosum the date in columns L to W. The autosums need to be at the end of the last data entry cell at the bottom. When i create a macro and apply it to a different data range it messes up the autosum. Any help will be hugely appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Code:
Sub Macro1()    Range("L1").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    Selection.FormulaR1C1 = "=SUM(R2C:R[-1]C)"
    Selection.Copy
    ActiveCell.Offset(0, 11).Select
    Range(Selection, Selection.End(xlToLeft)).Select
    ActiveSheet.Paste
    Calculate
End Sub
 
Last edited:
Upvote 0
Just change the start point from L1 to K1, and it will calcualte K:V instead of L:W.
Rich (BB code):
Sub Macro1()
    Range("K1").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    Selection.FormulaR1C1 = "=SUM(R2C:R[-1]C)"
    Selection.Copy
    ActiveCell.Offset(0, 11).Select
    Range(Selection, Selection.End(xlToLeft)).Select
    ActiveSheet.Paste
    Calculate
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,739
Messages
6,192,739
Members
453,755
Latest member
IQBS

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