Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2-dim array into sheet

Hi ya!

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

Help highly appreciated,

Fabaliciou

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default 2-dim array into sheet

fabalicious < wrote:

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...) ?


Range("A11").Resize(UBound(TwoDarray) - LBound(TwoDarray) + 1, _
UBound(TwoDarray, 2) - LBound(TwoDarray, 2) + 1).Value = TwoDarray

Alan Beban
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
Define a sheet in an array using a cell value VDU Excel Worksheet Functions 2 November 15th 07 02:00 PM
Sheet(Array( Won't print as I expect it to [email protected] Excel Worksheet Functions 0 June 21st 05 11:34 AM
writing array into excel sheet berrie Excel Programming 1 January 23rd 04 10:15 AM
Dumping the contents of a VBA array to a sheet Dave[_15_] Excel Programming 6 August 9th 03 02:35 AM
Copying an array variable to a sheet M Rose Excel Programming 0 July 14th 03 12:04 AM


All times are GMT +1. The time now is 12:26 AM.

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"