VBA 戻り値を配列

Function zf配列を戻り値(ByVal dataStr As String) As Variant()
    Dim returnArr() As Variant
    Select Case dataStr
        Case ""
            returnArr() = Array("a", "i", "u")
        Case ""
            returnArr() = Array("ka", "ki", "ku", "ke")
        Case ""
            returnArr() = Array("sa", "si", "su")
        Case ""
            returnArr() = Array("ta", "ti", "tu", "te", , "to")
    End Select
    
    zf配列を戻り値 = returnArr()
End Function

Sub zf配列戻り値Sample()
    Dim resArr As Variant
    Dim s As String
    Dim c As Long, i As Long
    
    s = ""
    resArr = zf配列を戻り値(s)
    For i = 1 To UBound(resArr)
        Debug.Print resArr(i)
    Next i
End Sub

コメント