Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
print values in an array
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
print values in an array
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 message ups.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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Array: Counting multiple values within array | Excel Worksheet Functions | |||
Use array to return array of values | Excel Worksheet Functions | |||
Print Array for hidden sheets using VBA | Excel Programming | |||
Convert values in a variant array to integer values | Excel Programming | |||
Print Array in Cell | Excel Programming |