https://bugs.documentfoundation.org/show_bug.cgi?id=89216

LeMoyne Castle <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|[email protected] |[email protected]
                   |desktop.org                 |

--- Comment #3 from LeMoyne Castle <[email protected]> ---
The use of a range in a spreadsheet function does produce an array of values
rather than an array of cells, at least within Basic.

The solution/workaround to get the cell status into a Basic macro is to use the
ISBLANK function to create a shadow range in the worksheet.  This range records
whether or not the corresponding cell in the original study range is empty or
not (column D in attachment). The Function then gets passed two arrays and can
work as desired.

Here is sample (similar, working code in attachment): 

Function StackNonEmpty2( range As Variant, IsEmpty As Variant, delimiter As
String )

    ' NEED to check parameters and exit gracefully
    ' NEED to check for workable dimension: range larger than IsEmpty => bug

    Dim result, tag As String
    Dim row, col As Integer

    result = ""
    For row = LBound( range, 1 ) To UBound( range, 1 )
        For col = LBound( range, 2 ) To UBound( range, 2 ) 
            If NOT CBool( IsEmpty( row, col ) ) then 
            Select Case VarType(range(row, col)): 
               Case 5: tag = "Double"
                   Case 8: tag = "String" 
               Case Else: tag = "other type"
                end select
            If result <> "" Then
                    result = result & delimiter
                End If
            result = result & range( row, col ) & ": " & tag
            End If            
        Next
    Next
    StackNonEmpty2 = result
End Function

There is almost certainly another solution that passes ADDRESS information to
the function.  The function would then interrogate the spreadsheet directly as
in raal's example above.  This second method would allow the Basic code to
gather more information about the Cells' type and status.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to