Worksheet arrays in VBA

  • Thread starter Thread starter Eero
  • Start date Start date
E

Eero

Hi,

I have created an array named by A in a workbook, say:

A={4;3;5;4;8;8;6}.

Now, how i can manipulate with this array in VBA environment? For
example to grab a value from A within a macro
 
Hi,

I have created an array named by A in a workbook, say:

A={4;3;5;4;8;8;6}.

Now, how i can manipulate with this array in VBA environment? For
example to grab a value from A within a macro


Try this:

Sub Eero()
third_element_of_A = Range("A")(3)
MsgBox third_element_of_A
End Sub

With your example data you should get a message box with 5 when you
run this macro.

Howeve, I would choose another name of the named range than "A" as
that can easily be confused with column A.

Hope this helps / Lars-Åke
 
Back
Top