I'm having a tough time getting all the values out of an array and into
an excel range. When I try to do it I only get the first value in the
array in all the cells in the range. Instead I want each element.
Here's the code:
Dim aSMASMA As Variant
Dim aTradedecision(1996) As Variant
Dim j As Integer
Dim element As Variant
Dim intTotaltradingdays As Integer
aSMASMA = Range("K5:L2000").Value
j = 0
For Each element In aSMASMA
If aSMASMA(j + 1, 2) <> Empty Then
aTradedecision(j) = aSMASMA(j + 1, 1) - aSMASMA(j + 1,
2)
j = j + 1
Else
Exit For
End If
Next
intTotaltradingdays = j
Range("M5").Resize(j).Value = aTradedecision()
Bookmarks