I 've created a custom function to estimate a factor based on 2 ranges : Well , AllWells ... what it does is it finds the last non empty cell in each column of allwells range and calculate : factor= Well/Sum(last cells in allwells.range) ....
so my problems are :
When i update unrelated cells... the whole table recalculates ( processors 4 calculating 0 % ) ... etc
When i add new row to my table it recalculates the 1100 cells again
The weird thing is when I change the related cells it only recalculates the adjacent cell with my custom function not the whole table like others !!!!!!
I've tried to make it as less volatile as possible but i dont know what else i can do :/ and where is the problem !!!
FYI i intend to use the formula in multiple sheets and multiple tables thats why i've used application.caller method to avoid problems..
so my problems are :
When i update unrelated cells... the whole table recalculates ( processors 4 calculating 0 % ) ... etc
When i add new row to my table it recalculates the 1100 cells again
The weird thing is when I change the related cells it only recalculates the adjacent cell with my custom function not the whole table like others !!!!!!
I've tried to make it as less volatile as possible but i dont know what else i can do :/ and where is the problem !!!
FYI i intend to use the formula in multiple sheets and multiple tables thats why i've used application.caller method to avoid problems..
Code:
Public Function FactorMe(Well As Range, AllWells As Range)
Dim ws As Worksheet
Dim rng As Range
Set ws = Application.Caller.Worksheet
Set rng = Range(ws.Cells(4, Well.Column), ws.Cells(Well.Row, Well.Column))
Lrow = rng.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
WellValue = ws.Cells(Lrow, Well.Column).Value
totalsum = 0
For i = AllWells.Column To AllWells.Column + AllWells.Columns.Count - 1
Set rng = Range(ws.Cells(4, i), ws.Cells(Well.Row, i))
Lrow = rng.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
totalsum = totalsum + ws.Cells(Lrow, i).Value
Next
If totalsum = 0 Then
FactorMe = 0
Exit Function
End If
FactorMe = WellValue / totalsum
End Function