Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

VBA-Excel: Create Array using Array() Function

Description:

You can cre­ate an array using Array() func­tion. You need to pro­vide all the ele­ments which you want in an array inside Array() and store it in a vari­able and that vari­able will be con­verted into array.

For­mat:

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

Argu­ments:

  • Ele­ments
    • Manda­tory
    • Type: Any Data Type


Exam­ple:

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

  Next

  MsgBox strString

End Function
Array Function

Array Func­tion 

You may also like...

Leave a Reply

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

%d bloggers like this: