vba function I wanted to port over to libreoffice -


This function works as Excel, but when I try to close it in libreoffice it does not work (Vba standards have been changed?)

variant () Apparently there is no datatype in the OpenOffice ...

but this is my code

  Public function RankECDF (ByRef r_values ​​as the range), in the form of variable () dim N, integer as M Variation in the form of numeral y () is different from N = r_values.Rows.Count M = r_values.Column.Count y = r_values.Value Variant redeem V (1 to N, 1 to M) as an array V = Worksheet Function. Sam (R_Values) R = 1 for N for C = 1 to M if y (R, C) = "" then V (R, C) = "" otherwise "error if cell was" "V (R) , C) = worksheet function. (Worksheet Function Rank) (y (r, c), r_values, 1), worksheet function., "& Lt; =" & y (r, c)) / worksheetFunction. Count (r_values) ends if next to next R. rank CDDF = V and function  

Yes, Open Office does not like the variant () , but this version As anything can happen, even a should be type () ok

> under v4.0, your code will be open to the basic debugger of the Open Office ( Tools -> Macros -> Organic Macros -> OpenOffice Basic ... ) and breaking it on N = r_values.Rows.Count shows the following:

Enter image details here

So it seems that r_values ​​ is not a range , but a different () .

When I change the code for the treatment of r_values ​​ (i.e. using UBound ) it seems to work, try it Do:

R_values.Rows.Count 'M = R_values.Column.Count N = UBound (r_values) M = UBound (r_values, 2) y = r_values ​​dim V () as Variant ReDim V (1 to N, 1 to M ) Total = WorksheetFunction.Sum (r_values) for R = 1 to M for C = 1m If y (r, c) = "" then we (r, c) = "otherwise" error occurs if the cell "V" (RC) = worksheet function was used for the work. WorksheetFunction.Rank (y (R) , C), r_values, 1), worksheet function. Contfag (r_values, "& lt; =" & (r, c))) / worksheet function. Count (r_values) End if Next C Next R RankECDF = V End function


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -