I have workbook contain multiple worksheets. I want a function which display the autosum of the current worksheet as well as previous not all. For example If I am on the sheet1 it and it has the value in the cell "E12" = 1 then I will write the function =autosum(E12) which will display result in E13 = 1. Then in the sheet2 if the same cell range E12 = 2 and I applied the function "=autosum(e12) it should display on the sheet2 E13 = 3. But when I go back to the sheet1 it should be displayed same as 1 not should display total for all.
I am using this function but it display same total on all the sheet. The function is as under.
Function AutoSum(rng As Range) As Variant
AutoSum = ActiveSheet.Range("E12").Value
Application.Volatile True
For Each WS In Worksheets
If Not WS Is Application.ThisCell.Parent Then
AutoSum = AutoSum + WS.Range(rng.Address)
End If
Next
End Function
The sheets layout is as under.