Thread: sum function
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] masterbigggy@gmail.com is offline
external usenet poster
 
Posts: 12
Default sum function

here is what i got for now .. but the sum formula dont show up in the
sheet. can someone help me

Dim GraphicWks As Worksheet
Dim DestCell As Range
Dim x As Range
Dim y As Range
Dim sumrng As Range


Set GraphicWks = Worksheets("calcul pour graphique")
With GraphicWks
Set DestCell = .Cells("3", .UsedRange.Columns.Count + 1)
Set x = .Cells("3", .UsedRange.Columns.Count)
Set y = .Cells(ActiveSheet.UsedRange.Rows.Count,
ActiveSheet.UsedRange.Columns.Count)
Set sumrng = Range(x, y)

End With



With DestCell
.Offset(17, 0).Formula = "=sum('" & sumrng
& "')"
End With


End Sub



please!

a écrit :

this work out good if i want the sum of only a1: to end of row..
but everytime the macro runs a new column is added. and this is the
column i want to have the sum

i have 2 headers on the top and like 12 values under it

week1
good

value 1
2
3
sum of all value




a écrit :

Hi,
try this :
Sub SUMMING()
Dim oEnd As Object, r
Set oEnd = Range("A65536").End(xlUp)
r = oEnd.Row + 1
Range("A" & r).Formula = "=sum(a1:a" & oEnd.Row & ")"
End Sub

Rgds,

Halim

menuliskan:
hi all,

i need help on how to put a sum function at the end of the last (rigth
end ) column.

follow the number for the macro sequence of where the data is input.

| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |
| 1 | 2 |

3(sum of all 1) 4(sum of all 2)

after each run of the macro there is a new colomn of data and a new
sum


thx for the help in advance