VBA功能可在Windows中使用,但不适用于Mac OS

时间:2018-07-11 06:13:45

标签: excel vba excel-vba excel-vba-mac

此VBA合并范围功能在Windows中有效,但在Mac OS中为#VALUE

Option Explicit

Public Function MergeRange(ParamArray rng()) As Single()
    Dim i As Long
    Dim count As Long
    Dim r As Excel.Range
    Dim s() As Single

    For i = LBound(rng) To UBound(rng)
        If (TypeOf rng(i) Is Excel.Range) Then
            For Each r In rng(i)
                ReDim Preserve s(count)
                s(count) = r.Value

                count = count + 1
            Next r
        End If
    Next i

    MergeRange = s
End Function

代码来自另一个stackoverflow线程How merge/mix range of cell as formula parameter

0 个答案:

没有答案