LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Populating a Temporary Array

Can anyone help me understand how to populate a temporary
array by row please. I am trying to take a column of
values H1:H256 on one sheet (Values change every time
sheet is calculated), and populate another sheet in the
range A2:IV1001. The current macro runs 1000 times and
works but is very slow, (even without selecting
anything). I thought that it might be quicker to
populate a temporary array row by row and then paste the
temporary array into the worksheet. I can understand the
logic in the following, but it does it cell by cell, and
what I'm struggling to understand is how I adapt it to
populate it row by row


Sub TranData2()

Dim i As Long
Dim TempArray() As Single
Dim TheRange As Range

ReDim TempArray(3 To 10, 4 To 16)
Set TheRange = Range(Cells(3, 4), Cells(10, 16))

CurrVal = 0
x = 1
For i = 3 To 10
For j = 4 To 16
TempArray(i, j) = Range("A3").Value
ActiveSheet.Calculate
Next j
Application.StatusBar = x
x = x + 1
Next i

TheRange.Value = TempArray

End Sub


I assume that I should use worksheetfunction.transpose to
transpose my column of values and then put them straight
into the temporary array, repeating and moving down a row
each time, but I can't work out how to do this.

The following (Ranges are test ranges only) is not
working but will give you some idea of what I'm trying to
achieve. Am I even on the right lines here?

Sub TranData()

Dim i As Long
Dim TempArray() As Long
Dim TheRange As Range

ReDim TempArray(3 To 10, 4 To 16)
Set TheRange = Range(Cells(3, 4), Cells(10, 16))

x = 1
For i = 3 To 10
TempArray(i) = WorksheetFunction.Transpose
("ColData").Value
ActiveSheet.Calculate
Application.StatusBar = x
x = x + 1
Next i

TheRange.Value = TempArray

End Sub

Thanks
Pete
 
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
Populating an array Bucs85027 Excel Worksheet Functions 0 February 14th 08 12:32 AM
Temporary Array i.e. match "this" and return entire row Alan[_7_] Excel Discussion (Misc queries) 1 August 13th 07 10:06 PM
Temporary Storage in IF function Chinni Krishna Reddy Excel Worksheet Functions 4 April 17th 07 01:58 AM
Calculating a Temporary Average Gail Gurman Excel Discussion (Misc queries) 0 January 24th 05 08:06 PM
populating multicolumn listbox with an array instead of... notsureofthatinfo Excel Programming 0 November 5th 03 10:18 PM


All times are GMT +1. The time now is 06:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"