I have recently been looking into Arrays to write data faster into Excel for reports.
I have come across this, VBA pasting 3 dimensional array into sheet, and it seemed fit to what I want to do. However, I want to do it in only one (1) sheet.
Dim arr(1 To 3)
Dim a As Integer
Dim x As Integer
Dim y As Integer
For a = 1 To 3
ReDim inner(1 To 5, 1 To 5)
'don't worry...makes a copy
arr(a) = inner
For x = 1 To 5
For y = 1 To 5
arr(a)(x, y) = a * x * y
Next
Next
Sheets(a).Select
Range(Cells(1, 1), Cells(5, 5)) = arr(a)
Next
Is it possible to output arr into excel range without looping?
Something like:
Range(Cells(1, 1), Cells(5, 5*3)) = arr
Expected Output:
1 1 1 1 1 - 2 2 2 2 2 - 3 3 3 3 3
1 1 1 1 1 - 2 2 2 2 2 - 3 3 3 3 3
1 1 1 1 1 - 2 2 2 2 2 - 3 3 3 3 3
1 1 1 1 1 - 2 2 2 2 2 - 3 3 3 3 3
1 1 1 1 1 - 2 2 2 2 2 - 3 3 3 3 3
I tried doing it buy I got #N/A
on my cells as outputs