Macro: Copying the Sum of Selected Cells

I wanted to start off with a fairly simple excel macro first. Although simple, this macro is very helpful when you want to copy the sum of several cells in an excel spreadsheet. The cells can be scattered throughout the spreadsheet or all in the same row/column.

Once you add this macro all you will need to do is highlight the cells you want to sum, run the macro (the macro will be named CopyDelectedSumValue), and then paste into the cell you want the sum in.

Note: This will just paste the value of the sum, not a sum( ) formula.

Excel Macro Code:

Sub CopySelectedSumValue()
   Dim MyDataObj As New DataObject
   MyDataObj.SetText Application.Sum(Selection)
End Sub

View the full listing of macros.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s