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
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
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" <[email protected]> wrote in message
news:O%[email protected]...
>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
>
>
Thanks, I thought there was a way.
Dan
"Chip Pearson" <[email protected]> wrote in message
news:[email protected]...
> 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" <[email protected]> wrote in message
> news:O%[email protected]...
>>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
>>
>>
>
>
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" <[email protected]> wrote in message
> news:[email protected]...
>
>>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" <[email protected]> wrote in message
>>news:O%[email protected]...
>>
>>>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
>>>
>>>
>>
>>
>
>
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks