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: 1
Default How do I assign values to an array?

Hi, Im having trouble assigning values to an array (nicely)
If you can assist or point me in the direction I would appretiate it.

Im writing a sheet where I want to dim an array, then assign variable
to the elements. The values are known in advance and I can set the
one at a time with the following code
MyArray(1) = 10: MyArray(2) = 27...

But I think i am looking for a vba version of something like..

Data 10,27,33,45,57
For valueCount = 1 to 5
Read AddValue(ValueCount)
Next ValueCount

I have the following code as an example of my current sollution,
but in fact I need to enter a minimum of 30 steps. I don't want t
read a range of cells for the values as ideally i want to keep in vba.

an example of my code

Dim AddValue(1 To 5) As Single
Dim ValueCount As Byte
Dim MyValue As Single

'---------------------[hmmm!]-----
AddValue(1) = 10
AddValue(2) = 27
AddValue(3) = 33
AddValue(4) = 45
AddValue(5) = 57
'----[ i'd like to assign these in loop with a data statement?? ]---

Do
ValueCount = ValueCount + 1
If ValueCount = 6 Then
ValueCount = 0
Exit Sub
Else
MyValue = MyValue + AddValue(ValueCount)
End If
Loop

End Sub


Any Assistance appretiated,

Regards

Skywa

--
Message posted from http://www.ExcelForum.com

 
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
Assign Values to array Jeff Excel Discussion (Misc queries) 14 July 15th 08 06:06 PM
Possible to assign an array to a SeriesCollection Stephen Boulet Excel Programming 2 November 13th 03 06:36 PM
Assign data to chart series, using array Stratuser[_2_] Excel Programming 1 July 24th 03 06:52 PM
how to assign ranges on different sheets to an array KRCowen Excel Programming 0 July 22nd 03 02:46 AM
how to assign ranges on different sheets to an array KRCowen Excel Programming 2 July 21st 03 03:27 AM


All times are GMT +1. The time now is 08:40 AM.

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"