Thread: Sum of data
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Chris Bode via OfficeKB.com Chris Bode via OfficeKB.com is offline
external usenet poster
 
Posts: 47
Default Sum of data

Here, I offer you a solution with macro
1.Right click toolbarselect control box
2.From the control box that appears on the screen select a command button and
draw it on your sheet
3.Double click the command button to open the code window and paste following
codes
#
Private Sub Command1_Click()
Dim row As Integer, col As Integer
row = 1
col = 1

Dim sum As Double
Dim x As Double
sum = 0
While Sheet1.Cells(row, col).Value < ""
x = Val(Sheet1.Cells(row, col).Value)
sum = sum + x

If (Val(Sheet1.Cells(row, col).Value) = 0) Then
Sheet1.Rows(row).Insert
row = row + 1

Sheet1.Cells(row - 1, col).Value = sum
sum = 0

End If

row = row + 1
Wend
End Sub
#

Have a nice time

Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com

--
Message posted via http://www.officekb.com