View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Summing same cell in mutiple Sheets

Hi,

Try the below code

Regards,
KL

Sub test()
With ThisWorkbook
LastSheet = .Sheets.Count - 1
For Each c In .Sheets("Wrap").Range("A1:A10")
MyFormula = "=SUM('" & Sheets(1).Name & ":" & _
Sheets(LastSheet).Name & "'!" & c.Address & ")"
c.Value = Evaluate(MyFormula)
Next
End With
End Sub


"Chaplain Doug" wrote in message
...
Excel 2002-2003. I build a workbook programmatically. The workbook has
mutiple sheets (and I know how many programmatically). I add a last sheet
that I want to be a "wrap" of all the other sheets. How do I
programmatically set a cell in the last sheet to be the sum of the same
cell
in all of the other sheets? Also, is there a way to do this
programmatically
for a range of cells rather than cell by cell? Thanks for the help. God
bless.