View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 126
Default 2-dim array into sheet

Use something like the tested:

Option Explicit

Function DimensionSize(Arr, Optional whatDim As Integer = 1)
On Error Resume Next
DimensionSize = UBound(Arr, whatDim) - LBound(Arr, whatDim) + 1
End Function
Sub transferDataToXL()
Dim SomeArr(2 To 21, 3 To 12) As Double, _
i As Integer, j As Integer
For i = LBound(SomeArr, 1) To UBound(SomeArr, 1)
For j = LBound(SomeArr, 2) To UBound(SomeArr, 2)
SomeArr(i, j) = i / j
Next j
Next i
Range("a1").Resize( _
DimensionSize(SomeArr, 1), DimensionSize(SomeArr, 2)).Value = _
SomeArr
End Sub

I will leave it up to you to figure out what portions of the above code
were needed for testing and what do the actual work. ;-)



--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2004

In article , fabalicious
says...
Hi ya!

Do you know a way to "paste" a 2-dimensional array (calculated in a
macro) into a sheet (where one dimension will be rows and another one
columns, obviously...) ?

Help highly appreciated,

Fabalicious


---
Message posted from http://www.ExcelForum.com/