Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filling an array with ranges | Excel Programming | |||
help with filling in an array formula | Excel Discussion (Misc queries) | |||
Filling an array from one sheet to another | Excel Programming | |||
filling a form with an array | Excel Programming | |||
Filling an array with data | Excel Worksheet Functions |