You are here:

Excel/How to sum using macros


Bhumi wrote at 2009-03-16 23:27:35
Just wanted to say, thank you very much for such an explainative and simple solution to a very complicated problem. i have been searching for this solution for months now!!! Thank you very very much!!!

rahul wrote at 2013-10-03 07:30:06
Sub Macro1()


' Macro1 Macro

' MyFirstMacro



   Application.WindowState = xlMinimized

   Application.WindowState = xlNormal

   Application.Goto Reference:="Macro1"

  ' MsgBox ("Welcome rahul")

   Dim lastrow As Long

   Dim irow As Long

   Dim icol As Integer

   lastrow = 0


   For icol = 1 To 4

    irow = Cells(65536, icol).End(xlUp).Row

    If irow > lastrow Then lastrow = irow

    Next icol


    For irow = 1 To lastrow


      Cells(irow, "E") = WorksheetFunction.Sum(Range(Cells(irow, "A"), Cells(irow, "D")).Value)


    Next irow



End Sub

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Damon Ostrander


I have extensive experience with VBA programming in Excel 5 through Excel 2013. As a former aerospace engineer with a large aerospace corporation and consultant in a small defense technology services company, I have developed a wide range of applications in VBA, including simulations involving mixed-language programming, satellite orbit mechanics, graphics and animation, and real-time applications. I am interested in moderate to hard VBA-related questions only.


I have developed and taught several courses in Excel VBA programming and also VBA programming in Office 97, 2000, and 2007. I have developed a number of large technical applications in Excel VBA for use within the aerospace industry.

B.S. in Electrical Engineering and Computer Science, University of California, Berkeley.

©2016 All rights reserved.