Hi everyone,

I use to work with excel in VBA Code but now i want to ease my administrative flow using google sheets and i want to know if someone can help me with this transition. Going from this VBA code to a Javascript one because google apps script is using Javascript.

Code:
Sub calcul()
 
 
Dim f As Long, r As Long, C As Long, J As Long
 
f = ActiveCell.Row
r = Cells(f, 3).Value
 
C = 0
J = 0
i = f



If Not IsEmpty(Cells(i - 1, 4)) Then
 
     If IsNumeric((Cells(i - 1, 4))) Then
 
     
           Do Until C + Cells(i, 4).Value >= r
           C = C + Cells(i, 4): Cells(f, 14) = C
           i = i - 1
           J = J + 1
           If Not IsNumeric(Cells(i, 4)) Then
           Exit Do
           End If
           Loop
    
 
           Cells(f, 18) = J
           X = f - J
           Cells(f, 19) = X
 
               If IsNumeric(Cells(X, 4)) Then
 
                  Cells(f, 15).Value = Cells(f, 14).Value + Cells(X, 4).Value
 
               Else
 
                  MsgBox "Données historiques insuffisantes"
                  Cells(f, 15) = Cells(f, 14) * (J + 1) / J
                  Cells(f, 11).Interior.Color = RGB(255, 165, 0)
               End If
 
           Cells(f, 14).EntireColumn.Hidden = False
           Cells(f, 15).EntireColumn.Hidden = False
           Cells(f, 16) = Cells(f, 3) / (Cells(f, 15) / (J + 1))
           Cells(f, 16).EntireColumn.Hidden = False
 
 
           Cells(f, 11) = Cells(f, 16)
 
      Else
 
           MsgBox "Données historiques insuffisantes"
 
           Cells(f, 11).Interior.Color = RGB(255, 165, 0)
           Cells(f, 11) = Cells(f, 3) / Cells(f, 4)
      End If
 
Else
 
    MsgBox "Données historiques insuffisantes"
    Cells(f, 11).Interior.Color = RGB(255, 165, 0)
    Cells(f, 11) = Cells(f, 3) / Cells(f, 4)
 
End If
 
 
 
End Sub