How to convert VBA to Google Apps Script?

前端 未结 5 1428
南笙
南笙 2021-01-17 23:06

My company is switching from Microsoft Office to Google Docs, I have this (several) code I want to use in Google Spreadsheets but I have no idea on how to do that.

C

5条回答
  •  情深已故
    2021-01-17 23:56

    The function is structured like this:

    Private Sub Worksheet_Change(ByVal Target As Range)
      Statements here
    End Sub
    

    That would probably convert to something like:

    function Worksheet_Change(ByVal) {
      Statements Here;
    };
    

    Instead of End Sub the function in JavaScript ends with a curly brace }.

    Instead of End If, the If, then statement also ends with a curly brace }.

    if (condition) {code here;}
    

    That's the syntax for a JavaScript If statement. There is no Then key word in JavaScript.

提交回复
热议问题