Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Declaring 2 dimensional arrays

I want to have an array - Item(100,2) where the first column is a string and
the second column is an integer.

Is this possible? If so how do I declare the variable.

Dan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Declaring 2 dimensional arrays

Declare the array type as Variant. It can hold any data type.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dan" wrote in message
...
I want to have an array - Item(100,2) where the first column is
a string and
the second column is an integer.

Is this possible? If so how do I declare the variable.

Dan




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Declaring 2 dimensional arrays

Thanks, I thought there was a way.

Dan
"Chip Pearson" wrote in message
...
Declare the array type as Variant. It can hold any data type.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dan" wrote in message
...
I want to have an array - Item(100,2) where the first column is a string
and
the second column is an integer.

Is this possible? If so how do I declare the variable.

Dan






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Declaring 2 dimensional arrays

For the particular case you describe, I believe you can also use

Dim Item(100,2) As String

I have no view on whether that is "better" than declaring it as a
Variant type.

Alan Beban

Dan wrote:
Thanks, I thought there was a way.

Dan
"Chip Pearson" wrote in message
...

Declare the array type as Variant. It can hold any data type.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Dan" wrote in message
.. .

I want to have an array - Item(100,2) where the first column is a string
and
the second column is an integer.

Is this possible? If so how do I declare the variable.

Dan






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Declaring 2 dimensional arrays


For my own education, what would be advantages and disadvantages to
using a user-defined type for this kind of situation?

Type myitems
a as string
b as integer
End Type

Sub test()
Dim item(100) as myitems

Code:
--------------------

End sub

where the variable is referenced using item(i).a="somestring" and item(i).b=someinteger


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=485333

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
Conditional IF formula using multi-dimensional arrays iperlovsky Excel Worksheet Functions 2 April 13th 10 05:15 PM
two dimensional arrays Dave Breitenbach Excel Worksheet Functions 4 September 19th 07 09:12 PM
declaring Arrays to use in a Form with few modules coco Excel Programming 3 July 18th 05 02:46 PM
Declaring arrays Alan Beban[_2_] Excel Programming 22 May 12th 04 08:10 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 01:56 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"