Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a Variant to Array Ivan Excel Programming 3 August 7th 05 12:42 PM
ReDim Object array as parameter of Variant array Peter T Excel Programming 4 May 10th 05 02:11 PM
Coercing a variant into an array Alex T Excel Programming 1 November 18th 04 09:54 PM
Variant Array Steph[_3_] Excel Programming 1 June 2nd 04 01:29 AM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"