Variant Array Custom Function Google Sheets? VBA For Example
问题 The following function below will add "1" to every column across the excel sheet. If I put =vbe(12) in A1, it will put "1" in columns "A1:L1". How can I translate this VBA to JavaScript for Google Sheets? Function vbe(Num As Long) As Variant Dim ary As Variant Dim i As Long ReDim ary(Num - 1) For i = 0 To Num - 1 ary(i) = 1 Next i vbe = ary End Function 回答1: You can write a custom formula that creates an array of "1"s with the length as a specified parameter, e.g. function myFunction