ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste Array into worksheet (https://www.excelbanter.com/excel-programming/336995-paste-array-into-worksheet.html)

Kaval

Paste Array into worksheet
 
Is there a one step way to paste an array into a spreadsheet without having
to cycle through each element?

I have a 9 x 9 array and I want to paste it into cells A1 to I9.

Thanks, Kaval

Norman Jones

Paste Array into worksheet
 
Hi Kaval,

Sub Tester01()
Dim arr(1 To 9, 1 To 9) As Variant
Dim i As Long, j As Long

For i = 1 To 9
For j = 1 To 9
arr(i, j) = i * j
Next j
Next i

Sheets("Sheet3").Range("A1:I9").Value = arr

End Sub

---
Regards,
Norman


"Kaval" wrote in message
...
Is there a one step way to paste an array into a spreadsheet without
having
to cycle through each element?

I have a 9 x 9 array and I want to paste it into cells A1 to I9.

Thanks, Kaval





All times are GMT +1. The time now is 07:16 PM.

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