Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

arrays

ResolvedVersion 2003

Ruan has attended:
Excel VBA Intro Intermediate course

Arrays

What are arrays used for?

RE: Arrays

Hi Ruan

In computer terms an array is a data structure consisting of elements that are accessed by indexing.

In most programming languages each element has the same data type and the array occupies a contiguous area of storage.

In VBA as with most other languages Variables normally only store a single value but, in some situations, it is useful to declare a variable as an Array that can store a series of related values.

The indexing in an array begins at 0 so declaring an array as

Dim SalesYear(5) as Integer

will allow you to store 6 years (0 t0 5)


This is because the 5 indicates that the upper space ion the array will be indexed with a 5

Then in the code SalesYear(3) will return the value stored in that section of the array

Hope this helps

Carlos

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Reset Excel toolbars to default settings

If you find any of your toolbars in Excel have changed (i.e. they are missing or have extra buttons) then you can reset them to their defaults.

1. Go to Tools - Customise.
2. Select the Toolbars tab.
3. Select (highlight) the name of the toolbar you wish to reset, then click the Reset button on the right.
4. Close the dialogue box.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.