Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet arrays in VBA

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet arrays in VBA

On 28 juuli, 23:36, Lars-Åke Aspelin
wrote:

Hi, Lars!

Thanks for responding. Actually the name A refers to no range but this
is a constant array.

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding 2 arrays, then use in worksheet function Rich_84[_2_] Excel Programming 4 April 1st 09 03:22 PM
Worksheet arrays VBA Phil G[_3_] Excel Programming 2 June 20th 08 01:43 AM
Linking arrays and Worksheet names gsimmons2005 Excel Worksheet Functions 2 August 18th 05 04:54 PM
Worksheet names to variant arrays Alasdair Stirling[_3_] Excel Programming 3 August 3rd 05 01:48 PM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"