View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RobcPettit[_2_] RobcPettit[_2_] is offline
external usenet poster
 
Posts: 108
Default print values in an array

Thankyou for your reply. This works great. Thankyou for taking the
time.
Regards Robert

On 29 Jan, 00:11, "Tom Ogilvy" wrote:
Here is one way:

Sub aBC()
Static runner()
Dim idex As Long
Dim v As Variant
Dim i As Long, j As Long
idex = 100
ReDim runner(1 To 1, 1 To idex)
For i = 1 To idex
runner(1, i) = Chr(Int(Rnd() * 26 + 65))
Next
j = 1
ReDim v(1 To 30, 1 To 1)
For i = idex - 30 + 1 To idex
v(j, 1) = runner(1, i)
j = j + 1
Next
Range("o1").Resize(UBound(v, 1), 1) = v

End Sub

--
Regards,
Tom Ogilvy

"RobcPettit" wrote in oglegroups.com...

Hi, I have an array 'Static runner()' which I redim when code calls
for it. 'redim runner(1 to 1, 1 to idex)'. Idex is a counter. The
arrays perfect, does everthing I want it to, but I cant seem to figure
out this. (Im sure Ive asked before but cant find the reply). If my
array has 100 values, how do I send just the last 30 values to the
worksheet. Im using Range("o1").Resize(UBound(Runner, 2), 1) =
Application.Transpose(Runner), but this adds all values.
Regards Robert