LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Filling an Array Quickly

Gary, I really appreciate your work

I am attempting to wrap my mind around arrays. What works for me, is understanding what all the
pieces/parts do and watch the input/output. That said, I am attempting to grasp when/where to Dim
as Variant vs Single and which can be a subset of the other and which cannot.

Looking at your code I have these questions:

Like it appears no accident that you used Y and YNot. Just cute labels? Or is
Y < Not Y; which evolved into Ynot or am I really off-base?

Option Base 1
Sub TransferTest()
ReDim y(1000, 10) As Variant 'Why reDim vs an initial Dim then resize?
ReDim ynot(1000, 10) As Single 'Why is "y" Dimmed as Variant and ynot as Single?
Dim r As Range
Set r = Range("A1:J1000")

y = r 'Seems we are cloning r "Range" into y as" Variant"
For i = 1 To 10
For j = 1 To 1000
ynot(j, i) = y(j, i) 'What is the logic as to this part of the process?
Next
Next
r = ynot 'What is the logic as to this part of the process?
End Sub


Bill Martin wrote:

Thanks. That is indeed faster. I'll use it.

Bill
------------------------------
Gary''s Student wrote:
You don't need loops to transfer data between the range and the arrays:

Option Base 1
Sub TransferTest()
ReDim y(1000, 10) As Variant
ReDim ynot(1000, 10) As Single
Dim r As Range
Set r = Range("A1:J1000")

y = r
For i = 1 To 10
For j = 1 To 1000
ynot(j, i) = y(j, i)
Next
Next
r = ynot
End Sub

This is nearly instantaneous, even though ynot is filled in two step rather
than directly.

 
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
Filling an array with ranges Greg Excel Programming 1 November 12th 07 09:24 PM
help with filling in an array formula Caitlin Excel Discussion (Misc queries) 5 November 7th 06 08:12 PM
Filling an array from one sheet to another fluffypluisje Excel Programming 3 May 24th 06 11:31 AM
filling a form with an array JT Excel Programming 1 October 26th 05 04:11 PM
Filling an array with data Dongle Excel Worksheet Functions 2 May 18th 05 06:06 PM


All times are GMT +1. The time now is 05:45 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"