Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coverting single-value array into an ordinary variable
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coverting single-value array into an ordinary variable
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coverting single-value array into an ordinary variable
Thanks a lot.
At least I know that there is no simple way of doing the job. Thanks. Frederick Chow Hong Kong. "Dave Peterson" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Coverting data in a one column into a single row | Excel Discussion (Misc queries) | |||
how do I make single character as a variable in an array | Excel Worksheet Functions | |||
Coverting array data into single column | Excel Worksheet Functions | |||
VBA - Convert my variable range array to single cell string | Excel Programming | |||
Coverting a VBA array from 2-D to 1-D | Excel Programming |