Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


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
Array: Counting multiple values within array Trilux_nogo Excel Worksheet Functions 4 April 16th 07 03:12 AM
Use array to return array of values Brad Excel Worksheet Functions 2 March 30th 06 05:58 PM
Print Array for hidden sheets using VBA Ant Excel Programming 0 March 23rd 06 08:26 AM
Convert values in a variant array to integer values Graham McNeill Excel Programming 1 November 13th 04 12:47 AM
Print Array in Cell ianripping[_90_] Excel Programming 5 August 18th 04 01:50 PM


All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"