Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring variable as a dynamic array? aiyer[_44_] Excel Programming 1 August 17th 04 11:01 PM
declaring a public array JT[_2_] Excel Programming 3 July 27th 04 11:18 PM
Q: Declaring a dynamic array Srdjan Kovacevic[_4_] Excel Programming 1 January 16th 04 07:24 PM
declaring an array of CheckBox's Didier Poskin Excel Programming 4 September 9th 03 09:02 AM
Declaring Dynamic Multi-dimensional Array JohnV[_2_] Excel Programming 2 July 15th 03 06:58 PM


All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"