VBA-Excel: Create Array using Array() Function


You can create an array using Array() function. You need to provide all the elements which you want in an array inside Array() and store it in a variable and that variable will be converted into array.


Array(Element1, Element2, Element3…..ElementN)


  • Elements
    • Manda­tory
    • Type: Any Data Type


Function FnArrayFunction()

    Dim arrA As Variant

  Dim strString

  arrA = Array("1", "5", "8", "10")

  For i = LBound(arrA) To UBound(arrA)

      strString = strString & " " & arrA(i) & vbCrLf


  MsgBox strString

End Function
Array Function

Array Function 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: