Excel 2010 - VBA - How to most efficiently add up columns in a worksheet

I have attached an Excel workbook that I would like to have two short columns summed (EAST AND WEST).
err  Here is a picture in case you don't want to open the actual workbook.

What is the most efficient way to code this.

I used this and it worked but I suspect there might be a more efficient way.
Option Explicit

Dim SalesEast As Currency
Dim SalesWest As Currency
Dim Sum As Currency
Dim CustomerName As String
Dim Price As Currency
Dim OrderDate As Date

Sub UsingOperators()

    ActiveCell.FormulaR1C1 = "=sum(r[-4]c:r[-1]c)"
    ActiveCell.FormulaR1C1 = "=sum(r[-4]c:r[-1]c)"
    SalesEast = Cells(9, 2).Value
    SalesWest = Cells(9, 3).Value
    Sum = SalesEast + SalesWest
    Cells(11, 4).Value = Sum

End Sub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi brothertruffle880,

Why are you using a macro to do this?
Why don't you just put this formula in cell D11:
Glenn RayExcel VBA DeveloperCommented:
I agree that inserting a formula in D11 is simplest, but if you want to insert that formula in VBA, here's your code with a simpler command to do that:
Sub UsingOperators()
    Range("B9").Formula = "=SUM(B5:B8)"
    Range("C9").Formula = "=SUM(C5:C8)"
    Range("D11").Formula = "=B9+C9"
End Sub

Open in new window

However, if your list of products varies, this code (nor the original code) would be helpful; a more dynamic set of formulas would be needed.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob HensonFinance AnalystCommented:
This is, I suspect, a summary of a larger data set.

How is the data organised?

You might be able to use a Pivot Table on the source data to give you the figures you require.

Rob H
brothertruffle880Author Commented:
HI All:
I'm experimenting with VBA.
I can definitely copy a function  and find easier ways to get this job done  But my purpose in posting the question was to explore alternative ways of getting something done in VBA.  
I'm looking for alternatives to my solution using VBA code.
Hi brothertruffle880,

That's the kind of info that it is good to have clearly stated in the original post, because when I read it, it looked as if you wanted efficiency, and you thought you needed to VBA to do it.  So please bear that in mind for future questions, so experts don't waste time going down fruitless tracks.

Given your requirements, what is wrong with Glenn's solution?  Looks pretty efficient (and concise) to me.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.