View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default how do i fill an array? tia

see if this will work

Sub test()
Dim arr As Variant
Dim x As Integer, n As Integer
ReDim arr(100)

For n = 1 To 100
ReDim Preserve arr(1 To n)
arr(n) = 5
Next n
End Sub

--


Gary


"JasonK" wrote in message
...
i know this is probably pretty basic but i can't find it in my dummies
book.

i have an array labeled M.
i've dimensioned it to 100 using the statement:

dim m(100)

i tried to run a for/next loop to fill it but it isn't working

for x = 1 to 100
m(x)=5
next x

this should fill array with 5's but it's giving me an error:
sub or function not defined.

thanks for your help
fred