Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Put values into excel range from single dimension array

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()

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Put values into excel range from single dimension array

Range("M5").Resize(j).Value = _
Application.Transpose(aTradedecision())

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
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()



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Put values into excel range from single dimension array

Thx again Tom...that worked

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
Mutli-dimensional Array to Single-Dimension Array Blue Aardvark Excel Programming 3 October 15th 05 09:22 AM
HOW TO ASSIGN 2 DIMENSION ARRAY VALUES FROM 2 COLUMNS? -JEFF-[_2_] Excel Programming 3 August 12th 05 05:36 PM
Writing Single Dimension Array to Active Sheet Fid[_2_] Excel Programming 2 June 23rd 05 09:26 PM
Array transfer - 1 dimension v. 2 dimension JWolf[_2_] Excel Programming 2 June 29th 04 01:02 AM
single dimension array RobcPettit Excel Programming 3 January 20th 04 08:33 AM


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