I have been using Excel VBA code since couple of months and it was working fine now i have to move this code to Google Sheets to access it from anywhere.
I am not an expert but i tried hard to convert this VBA code to Google App script but its still not working.
The code is very simple in VBA but difficult one is in Google Sheets for me. I was hoping to get some help for it.
Option ExplicitPrivate Sub worksheet_Change(ByVal Target As Range)'Variables On Error Resume Next Dim dblWert As String Dim strCellAdresse As String'Define the area to be evaluated If Not Application.Intersect(Target, Range("E7:E32")) Is Nothing Then'Transfer cell address strCellAdresse = Target.Address'Change column E to F. strCellAdresse = Replace(strCellAdresse, "E", "F")'Remove dollar sign strCellAdresse = Replace(strCellAdresse, "$", "")'Pass value to variable dblWert = Range(strCellAdresse).Value'Format cell'Pass variable to cell Range("D38").Value = Format(dblWert, "#,##0.00 €") End IfEnd SubGoogle Sheet AppScript
function Toworkon() {var Exsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Expiriment");var Exrange = Exsheet.getRange('E7:E32').getValues();//'Change column E to F. Rngrplc = Replace(Exrange, "E", "F");//'Remove dollar sign Rngrplc = Replace(Exrange, "$", "")// 'Format cell// 'Pass variable to cellvar cell = Exsheet.getRange("D38").getValues();cell.setNumberFormat("#,##0.00 €");}