VBA Macro to sum a variable range and put the result in the specified column

Wither125

New Member
Joined
May 16, 2016
Messages
5
Hello,

I am creating a macro that would calculate the sum from the column(TOTAL_DLR_AM) of the table(calculation) and paste the calculated sum in the next table(Approvals Summary) in the column(Sum).
However i try but i am only able to calculate the sum but not able to paste the calculated sum in the column(Sum).

I am not using the range select because the data in the table (calculation) will very.

Below is the code:

Sub Macro()

Windows("techdata.xlsm").Activate
Sheet1.Activate
ActiveCell.FormulaR1C1 = "Sum"
ActiveCell.Offset(0, 1).Select
myrow = Range("E6666").End(xlUp).Row
ActiveCell.Offset(0, 4).Formula = "=SUM(E3:E" & myrow & ")"

Sheet1.Columns().AutoFit

End Sub

I am not getting any errors when running the macro but it doesn't paste the calculated sum in the column (Sum).

Looking forward for your answer and Thanks for your help in advance!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
yes i am summing the column (TOTAL_DLR_AM) and its working fine ,but i am not able to paste the calculated sum in the column named sum ,u can see it in the below image.
So any idea how do i put the calculated sum in the column sum.

tech.png
 
Upvote 0
SYe8E2.jpg


something like that?

But it seems like the one you show is not a table. I created a table called "calculationt".
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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