Hi Ramesh Try below code. File containing this code is also attached with this email reply.
Sub Ramesh() Application.ScreenUpdating = False Application.DisplayAlerts = False Dim i, k As Integer Cells(1, 1).Select For k = 1 To 256 ActiveCell.EntireColumn.Select i = Application.WorksheetFunction.Sum(Selection) On Error GoTo DKP_Error If i = 0 Then ActiveCell.Offset(0, 1).EntireColumn.Select Else MsgBox ("Sum of this column's data is " & i) ActiveCell.Offset(0, 1).EntireColumn.Select End If Next Exit Sub DKP_Error: MsgBox ("All columns have been checked") End Sub Note:- It will check each column one by one and show up the sum value as a message. Thanks, -- DILIP KUMAR PANDEY MBA-HR,B COM(Hons.),BCA Mobile: +91 9810929744 dilipan...@gmail.com dilipan...@yahoo.com New Delhi - 110062 On Fri, May 29, 2009 at 8:17 PM, Ramesh Katta <kr.sap...@gmail.com> wrote: > > Hi Gurus, > > I am Ramesh, new to vba programs. I need a macro to calculate sum for > range of column. The should be displayed with MsgBox. > > For example: Column A has numbers 1,2,3,4,5,6,7,8,9,10................... > > I want to calculate the cells we entered and displayed on MsgBox. > > > Thanks&Regards > Ramesh > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---
Display sum of the column data.xls
Description: MS-Excel spreadsheet