arrays

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Arrays

Arrays

resolvedResolved · Low Priority · Version 2003

Kelvin has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Arrays

What is an array?

RE: Arrays

Hi Kelvin

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)

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

Hope this helps

Carlos

Tue 21 Apr 2009: Automatically marked as resolved.

 

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:

Checking if a calculation adheres to Order of Precedence

When writing formulas you must make sure that results will be calculated as you intended.

Excel adheres to the standard order of precedence for calculations. It calculates percentages, exponents, multiplication, and division in this order before calculating addition and subtraction.

For example, =7+5*3 results in an answer of 22, not 36.

To force a calculation to be completed before another calculations, place the section in parentheses: =(7+5)*3 will result in 36.

To check how excel is evaluating a formula, click on the cell and select the 'Tools' menu, select 'Formula Auditing' and click 'Evaluate Formula'

In the dialog box click on 'Evaluate' to watch as each part of the formula is successively calculated.

View all Excel hints and tips


Server loaded in 0.08 secs.