Afnan
Afnan

Reputation: 35

Declare Variable in VBA

I am beginner in vba, I can’t understand the below code even I searched a lot about it and didn’t find any thing. What is the meaning of put (x) and declare it with different type?

    Const x = 25 
    Dim y(x) As Double
    Dim z(x) As Boolean

Any hlep will be appreciation

Upvotes: 1

Views: 895

Answers (2)

06needhamt
06needhamt

Reputation: 1605

This is declaring an array with the same amount of values as x as the specified type

Const x = 25 
    Dim y(x) As Double = array of 25 double
    Dim z(x) As Boolean = array of 25 booleans

Upvotes: 1

RichieHindle
RichieHindle

Reputation: 281875

y and z are arrays, each with 25 elements.

y is an array of 25 Doubles and z is an array of 25 Booleans.

There are any number of VBA tutorials that will teach you about arrays; here's one example: Array in Excel VBA

Upvotes: 3

Related Questions