variant-array

Variant Array Custom Function Google Sheets? VBA For Example

99封情书 提交于 2021-01-29 10:30:26
问题 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

Cannot use an If-statement with multiple conditions (AND/OR) when looping through variant array?

倖福魔咒の 提交于 2019-11-27 18:33:19
问题 Background: In working with some variant arrays to sort data to multiple locations based on criteria, I noticed that using an if-statement with multiple criteria flagged as false every time. This was being used to create a dictionary, though it never made it to the dictionary aspect, due to the false response when looping only through the variant array. I moved these to two separate if-statements and everything worked as expected. Question: Why am I unable to use a multi-condition if