Hi,

I use the code below push a calculation formula to U11:U.
I want to execute it with a change by val event. If a cell in the range R11:R511 is changed I want
to execute
 "=T11/S11"
.
However I only want the macro to set the formula on the same row as the cell that has been changed in R11:R511.

But I can't get it to work. Any help ?: )




Sub CalcTg()

Dim LastRow As Long
     
    LastRow = Cells(Rows.count, "O").End(xlUp).Row
    
        If WorksheetFunction.CountA(Range("O11:O511")) >= 1 Then
    
        sheets("Kalkyl").Range("U11:U" & LastRow).Formula = "=T11/S11"
    
        End If

End Sub