vba copy rounded sum of range to another workbook

wynandbez

New Member
Joined
Feb 4, 2008
Messages
27
Hi All,

I'd like to copy the sum of a range from one workbook and paste the rounded value into another workbook. Not too sure how to code this in VBA...

E.g.

Source workbook
Cell A1: 100,000,000
Cell A2: 200,000,000
Cell A3: 300,000,000

Sum = 600,000,000

Destination workbook
Cell A1: 600

(Rounded to the nearest million)

Appreciate any help
Thanks!
 

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.
As an amateur I would avoid using vba and just put the following formula in a dummy cell (perhaps Cell A4 of the Source workbook):
=ROUND(SUM(A1:A3),-6)

then in Cell A1 of the Destination workbook I would put the formula:
=[source.xls]Sheet1!$A$4

...or you could use the vba recorder to go through the steps and use the vba code from there...

Hope this helps and doesn't hurt!
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
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