Autosum Macro

RevZ

New Member
Joined
Sep 22, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a report that I pull from Sage into Excel, however it creates Subtotals for each of the Suppliers invoices.

As you can imagine there's quite a few suppliers on the list and the totals from the report don't contain an autosum amount, just the text amount from the report.

Is there an easy way in which I can make a macro that will create the autosum for each of the subtotals so if I manipulate the data and delete rows, it generates the correct subtotal?

Thanks,
RevZ
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I am sure there is a way to do what you want. I'm just not sure what it is exactly you want.

You can create a macro which functions the same as AutoSum.
VBA Code:
Sub Test__Sum_All_Values_In_This_Range()
MsgBox Sum_All_Values_In_This_Range(ActiveSheet.name, "A1:A30")
End Sub
Function Sum_All_Values_In_This_Range(sheetName As String, rangeAddress As String)
Sum_All_Values_In_This_Range = Application.Sum(Sheets(sheetName).Range(rangeAddress))
End Function

Or you can have a macro write an autosum formula for you. (Which is kind of redundant, as that's very easy to do yourself.)
 
Upvote 0
Welcome to the MrExcel board!

Can you post a small section of your worksheet (any sensitive data disguised) that shows the layout of the data and where these 'fixed' subtotals are (with XL2BB)?
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,688
Members
449,117
Latest member
Aaagu

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