Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring one bidimensinal Array
Hi!
And Thanks in advance! I would like to have this array, kind of: MyArray=Array(1,5;2,3;5,4;6,6;10,7) this is just one example. I am trying to get one array having the X and Y values of a differen cells. * * * how can i doing this MyArray(1).select and keep selected the Range("P2") cell if Activecell is [A1] Many thanks PS at the moment i am doing this: MyArray = Array(1, 5, 2, 3, 5, 4, 6, 6, 10, 7) For X = 0 To 9 ActiveCell.Offset(MyArray(X), MyArray(X 1)).interior.colorindex=3 'just example Debug.Print ActiveCell.Address X = X + 1 Next -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring one bidimensinal Array
You could try doing it this way.
Sub Arrays_Test() Dim lngCell(1 To 5, 1 To 2) As Long Dim lngX As Long lngCell(1, 1) = 1 lngCell(1, 2) = 5 lngCell(2, 1) = 2 lngCell(2, 2) = 3 lngCell(3, 1) = 5 lngCell(3, 2) = 4 lngCell(4, 1) = 6 lngCell(4, 2) = 6 lngCell(5, 1) = 10 lngCell(5, 2) = 7 For lngX = 1 To 5 With ActiveSheet.Cells(lngCell(lngX, 1), lngCell(lngX, 2)) Debug.Print .Address End With Next lngX End Sub This routine gives the following results. It doesn't change the currently selected cell. $E$1 $C$2 $D$5 $F$6 $G$10 Regards, Wes |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring one bidimensinal Array
for a small number of elements
MyArray = Evaluate("{" & "1, 5; 2, 3; 5, 4; 6, 6; 10, 7" & "}") this will give a 1x5, 1x2 array from the immediate window: MyArray = Evaluate("{" & "1, 5; 2, 3; 5, 4; 6, 6; 10, 7" & "}") ? lbound(myarray,1), ubound(myarray,1) 1 5 ? lbound(myarray,2), ubound(myarray,2) 1 2 -- Regards, Tom Ogilvy "Andoni " wrote in message ... Hi! And Thanks in advance! I would like to have this array, kind of: MyArray=Array(1,5;2,3;5,4;6,6;10,7) this is just one example. I am trying to get one array having the X and Y values of a different cells. * * * how can i doing this MyArray(1).select and keep selected the Range("P2") cell if Activecell is [A1] Many thanks PS at the moment i am doing this: MyArray = Array(1, 5, 2, 3, 5, 4, 6, 6, 10, 7) For X = 0 To 9 ActiveCell.Offset(MyArray(X), MyArray(X + 1)).interior.colorindex=3 'just example Debug.Print ActiveCell.Address X = X + 1 Next X --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Declaring variable as a dynamic array? | Excel Programming | |||
declaring a public array | Excel Programming | |||
Q: Declaring a dynamic array | Excel Programming | |||
declaring an array of CheckBox's | Excel Programming | |||
Declaring Dynamic Multi-dimensional Array | Excel Programming |