View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default Worksheet arrays in VBA

On Tue, 28 Jul 2009 13:12:31 -0700 (PDT), Eero
wrote:

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