ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Paste Array (https://www.excelbanter.com/excel-discussion-misc-queries/112014-paste-array.html)

Jeff

Paste Array
 
Hi,

I have an array

Array(750,200)

I want to paste the contents into the worksheet, i tried

Sheets("Sheet1").Range("C1:GU750").Value =
Application.WorksheetFunction.Transpose(Array)

but this didnt work, I guess because of transpose?

Is there a way to output a 2x2 array automatically?

Thanks for your help!!!

Dave Peterson

Paste Array
 
There is a limit of how many elements you can transpose in xl2k and below. If I
recall correctly, it's 5461 elements.

And your array is at least 750*200=150,000 elements.

But I'm not sure why you want to transpose the array anyway. If you're using
xl2003 or below, you only get 256 columns. So 700 columns won't fit.

This worked ok for me in xl2003:

Option Explicit
Sub testme02()

Dim myArr(1 To 750, 1 To 200) As Variant
Dim iCtr As Long
Dim jCtr As Long

For iCtr = LBound(myArr, 1) To UBound(myArr, 1)
For jCtr = LBound(myArr, 2) To UBound(myArr, 2)
myArr(iCtr, jCtr) = "x-" & iCtr & "-" & jCtr
Next jCtr
Next iCtr

Sheets("Sheet1").Range("C1") _
.Resize(UBound(myArr, 1) - LBound(myArr, 1) + 1, _
UBound(myArr, 2) - LBound(myArr, 2) + 1).Value _
= myArr

End Sub



Jeff wrote:

Hi,

I have an array

Array(750,200)

I want to paste the contents into the worksheet, i tried

Sheets("Sheet1").Range("C1:GU750").Value =
Application.WorksheetFunction.Transpose(Array)

but this didnt work, I guess because of transpose?

Is there a way to output a 2x2 array automatically?

Thanks for your help!!!


--

Dave Peterson


All times are GMT +1. The time now is 08:01 AM.

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