PC Review


Reply
Thread Tools Rate Thread

Coverting single-value array into an ordinary variable

 
 
Fred Chow
Guest
Posts: n/a
 
      25th Oct 2007
Dear all,

I have a single-valued array X (i.e., its dimensions is 1-by-1) which holds
an integer. Is there an easy way of converting it back to an ordinary
integer variable? Thanks a lot.

Frederick Chow
Hong Kong


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      25th Oct 2007
If you don't know how the array is dimensioned, you could do something like:

Dim myArr(7 To 7, 19 To 19) As Long
Dim myNumber As Long
myArr(7, 19) = 123 'assign it someway
myNumber = myArr(LBound(myArr, 1), LBound(myArr, 2))
MsgBox myNumber

If you knew the array dimensions:

Dim myArr(1 To 1, 1 To 1) As Long
Dim myNumber As Long
myArr(1,1) = 789 'assign it someway
myNumber = myArr(1, 1)
MsgBox myNumber

Fred Chow wrote:
>
> Dear all,
>
> I have a single-valued array X (i.e., its dimensions is 1-by-1) which holds
> an integer. Is there an easy way of converting it back to an ordinary
> integer variable? Thanks a lot.
>
> Frederick Chow
> Hong Kong


--

Dave Peterson
 
Reply With Quote
 
Fred Chow
Guest
Posts: n/a
 
      25th Oct 2007
Thanks a lot.

At least I know that there is no simple way of doing the job. Thanks.

Frederick Chow
Hong Kong.

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If you don't know how the array is dimensioned, you could do something
> like:
>
> Dim myArr(7 To 7, 19 To 19) As Long
> Dim myNumber As Long
> myArr(7, 19) = 123 'assign it someway
> myNumber = myArr(LBound(myArr, 1), LBound(myArr, 2))
> MsgBox myNumber
>
> If you knew the array dimensions:
>
> Dim myArr(1 To 1, 1 To 1) As Long
> Dim myNumber As Long
> myArr(1,1) = 789 'assign it someway
> myNumber = myArr(1, 1)
> MsgBox myNumber
>
> Fred Chow wrote:
>>
>> Dear all,
>>
>> I have a single-valued array X (i.e., its dimensions is 1-by-1) which
>> holds
>> an integer. Is there an easy way of converting it back to an ordinary
>> integer variable? Thanks a lot.
>>
>> Frederick Chow
>> Hong Kong

>
> --
>
> Dave Peterson



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign a single variable to an Array filled with same data types RyanH Microsoft Excel Programming 7 21st Jul 2008 09:05 PM
how do I make single character as a variable in an array =?Utf-8?B?SGF6bGdybmd1eQ==?= Microsoft Excel Worksheet Functions 1 25th Sep 2005 08:12 AM
Coverting array data into single column =?Utf-8?B?ZGdhcmc=?= Microsoft Excel Worksheet Functions 4 15th Dec 2004 07:43 AM
Put array values into a single variable =?Utf-8?B?aHV6eg==?= Microsoft ASP .NET 4 6th Dec 2004 12:29 PM
VBA - Convert my variable range array to single cell string Kevin G Microsoft Excel Programming 6 28th Jan 2004 07:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:46 AM.