View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Multidimensional Arrays - VBA

Alan has written a lot of code to manipulate arrays and generously provided
it and shown you how to use it in this situation. However, if, perhaps,
this is a learning exercise and you want to use a simple loop to find the
value you could do

sStr = "Fish"
for i = lbound(myarray,1) to ubound(myarray,1)
if ucase(sStr) = Ucase(myarray(i,Lbound(myarray,2)+1)) then
res = myArray(i,Lbound(myarray,2)+2)
exit for
end if
Next
msgbox res

This looks only in the second column of your array.


Regards,
Tom Ogilvy


"Brent McIntyre" wrote in message
...
Tom,

Thanks very much for your help, but I think I have confused everyone,
including myself.

What I want to do is create a virtual table via an array of 151 rows and
6 columns.

I have worked out the whole thing of writing in the array, ie setting up
the virtual table, but I am not sure how to access it, I need to be able
to get a certain value, check whether it appears in a certain column and
if it does display the information from another column.

ie

Virtual Table
One Cat Apartment
Two Fish House
Three Cow Flat

And if the read in value is "Fish" I want it to output "House"

I hope this makes it all a bit more clear.

Thank you all for your help it is much appreciated, this is my first
time using Multidimensional Arrays.

Yours sincerely,

Brent McIntyre

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!