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

VBA-Excel: Fill Excel Range Values in a 2D Array

You can fill a range val­ues from an excel work book into a two dimen­sional array. All you have to do is assign range val­ues to a vari­able and then that vari­able will become array

Two Dimensional Dynamic array -1

Two Dimen­sional Dynamic array –1

Func­tion FnFil­l­Val­ues()

    arrTwoD2 = Sheet9.Range(“A1: B5”)   

Msg­Box “The value is B5 is ” & arrTwoD2(3, 2)

End Func­tion

Two Dimensional Array -2

Two Dimen­sional Array –2

You may also like...

1 Response

  1. Bob Bell says:

    I have text data in excel work­sheet in the cells B6:H14.
    Some rows will have 2 cells with con­tents while oth­ers have 4 and some will have 7. How do I copy these to a 2 dimen­sional array? I know the dimen­sions already and so, I am ok with the dimen­sions not being declared dynamic code.
    Do I need to use a loop (which I am cur­rently plan­ning to use)?
    Or is there an eas­ier / more ele­gant way?

Leave a Reply

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

%d bloggers like this: