Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declare an Array() ????
Hi, and Many Thanks in advance
what's wrong he I would like to declare the XeY array properly, but don't know how Sub Myarray() Dim XeY '????????????????(7) As Variant Dim X As Byte X = Int((2* Rnd) + 1) Dim Y As Byte Select Case X Case 1: XeY = Array(2, 1, 0, -1, -1, 0, 1, 2) Case 2: XeY = Array(-1, 0, 1, 2, 1, 0, -1, -2) End Select For Y = LBound(XeY) To UBound(XeY) MsgBox XeY(Y) Next Y End Sub MyArray sub is just one example, has nothing to do with my request, only want to know how can I declare the XeY array properly when XeY will have always 7 elements ranging each element from 0 to 9. XeY(7) as Byte does not wor -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declare an Array() ????
declare it as variant. You can declare it as a variant array in xl2000 or
later Dim XeY() as variant but you gain nothing doing this and make it incompatible with xl97. Sub Myarray() Dim XeY as variant Dim X As Byte X = Int((2* Rnd) + 1) Dim Y As Byte Select Case X Case 1: XeY = Array(2, 1, 0, -1, -1, 0, 1, 2) Case 2: XeY = Array(-1, 0, 1, 2, 1, 0, -1, -2) End Select For Y = LBound(XeY) To UBound(XeY) MsgBox XeY(Y) Next Y End Sub -- Regards, Tom Ogilvy "Andoni " wrote in message ... Hi, and Many Thanks in advance what's wrong he I would like to declare the XeY array properly, but don't know how Sub Myarray() Dim XeY '????????????????(7) As Variant Dim X As Byte X = Int((2* Rnd) + 1) Dim Y As Byte Select Case X Case 1: XeY = Array(2, 1, 0, -1, -1, 0, 1, 2) Case 2: XeY = Array(-1, 0, 1, 2, 1, 0, -1, -2) End Select For Y = LBound(XeY) To UBound(XeY) MsgBox XeY(Y) Next Y End Sub MyArray sub is just one example, has nothing to do with my request, I only want to know how can I declare the XeY array properly when XeY will have always 7 elements ranging each element from 0 to 9. XeY(7) as Byte does not work --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Declare variables to a code? | Excel Discussion (Misc queries) | |||
Declare Variables in Array | Excel Discussion (Misc queries) | |||
How to declare a dynamic array | Excel Discussion (Misc queries) | |||
How to declare Multi-dimensional dynamic array? | Excel Programming | |||
declare a two dimenssion array | Excel Programming |