Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying a Variant Array to a worksheet
What is the short-hand method to copy a varaint array to a worksheet.
Given a variant array called vaData which is 10 rows x 5 columns Range("F20:I26").Value = vaData 'Would copy the data to F20:I26 How can this be written dynamically using Ubound(vaData) and UBound(vaData,2) in place of the cell range reference? -- Regards, John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying a Variant Array to a worksheet
If the array is a 2-D 1-based array all will be the same as the range as
this Sub shows: Sub test() Dim arr arr = Range(Cells(1), Cells(10, 10)) Range(Cells(LBound(arr), LBound(arr, 2)), Cells(UBound(arr), UBound(arr, 2))) = arr End Sub RBS "John Keith" wrote in message ... What is the short-hand method to copy a varaint array to a worksheet. Given a variant array called vaData which is 10 rows x 5 columns Range("F20:I26").Value = vaData 'Would copy the data to F20:I26 How can this be written dynamically using Ubound(vaData) and UBound(vaData,2) in place of the cell range reference? -- Regards, John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying a Variant Array to a worksheet
Just answered my own question...
Addr = "$F$20" Addr = Addr & ":" & Range(Addr).Cells(UBound(vaData), _ UBound(vaData, 2)).Address Range(Addr).Value = vaData -- Regards, John "John Keith" wrote: What is the short-hand method to copy a varaint array to a worksheet. Given a variant array called vaData which is 10 rows x 5 columns Range("F20:I26").Value = vaData 'Would copy the data to F20:I26 How can this be written dynamically using Ubound(vaData) and UBound(vaData,2) in place of the cell range reference? -- Regards, John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Moving a Variant to Array | Excel Programming | |||
ReDim Object array as parameter of Variant array | Excel Programming | |||
Coercing a variant into an array | Excel Programming | |||
Variant Array | Excel Programming | |||
variant array containing cel adresses convert to actual ranges-array | Excel Programming |