Anyway to convert excel VBA to Google Appscript so that I can use it on Google spreadsheet? I need following code to convert to google script
Sub ReCalculate()
Dim i As Integer, j As Integer, NoOfRows As Integer
' Get total number of rows
With Sheet1
NoOfRows = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
' add all the duplicated values and replace the duplicates with "DELETE" to be deleted later.
For i = 2 To NoOfRows
For j = i + 1 To NoOfRows
If Cells(i, 1).Value = Cells(j, 1).Value And Cells(j, 1).Value <> "DELETE" Then
Cells(i, 2).Value = Cells(i, 2).Value + Cells(j, 2).Value
Cells(j, 1).Value = "DELETE"
Cells(j, 2).Value = "0"
End If
Next j
Next i
' Get total number of rows
With Sheet1
NoOfRows = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
' Delete all rows with word "DELETE"
For i = 2 To NoOfRows + 1
If Cells(i, 1).Value = "DELETE" Then
Rows(i).EntireRow.Delete
i = i - 1
End If
Next i
End Sub