ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range object to Array object conversion (https://www.excelbanter.com/excel-programming/273264-re-range-object-array-object-conversion.html)

Myrna Larson[_2_]

Range object to Array object conversion
 
It won't work if you wrote

Dim MyArray1() As Variant

But it WILL work if you write

Dim MyArray1 As Variant 'no parentheses

On Thu, 31 Jul 2003 16:00:36 -0700, "Yogesh" wrote:

HI ,
The following code works fine :
'eg. of array being assigned to a range object
.Range("A1:A2").Value = MyArray
'just wanted to know whether the reverse is possible
' i.e. something like ---
' MyArray1 = .Range("A1:A3") 'This not working with VBA

Thanks,
Yogesh



Alan Beban[_3_]

Range object to Array object conversion
 
Either one works, at least in xl2000 and later.

Alan Beban

Myrna Larson wrote:
It won't work if you wrote

Dim MyArray1() As Variant

But it WILL work if you write

Dim MyArray1 As Variant 'no parentheses

On Thu, 31 Jul 2003 16:00:36 -0700, "Yogesh" wrote:


HI ,
The following code works fine :
'eg. of array being assigned to a range object
.Range("A1:A2").Value = MyArray
'just wanted to know whether the reverse is possible
' i.e. something like ---
' MyArray1 = .Range("A1:A3") 'This not working with VBA

Thanks,
Yogesh






All times are GMT +1. The time now is 02:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com