#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Array Help?

Hi- I need help reading two rows to an array. I have a list of names in the first row, columns G:P and a list of numbers in the 10th row, columns G:P. I want to read in the two rows, and (i think) transpose them before they are in the array so that they are actually two columns in the array. I next want to sort them and grab the 5 lowest numbers (and associated names). I'm fairly confident in VBA for access, but I'm getting a bit thrown off my this Excel stuff

I'm aware this is the 2nd time I've posted, but I'm in a bit of a time crunch. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array Help?

Dim varr as Variant
Dim rng as Range, rng1 as Range
set rng = Range("G1:P1")
set rng1 = range("G10:P10")
redim vArr(1 to 10, 1 to 2)
for i = 1 to 10
varr(i,1) = rng(1,i)
varr(i,2) = rng1(1,i)
Next

You said you had the sort down, so I guess that is what you need.


--
Regards,
Tom Ogilvy


"Carrie" wrote in message
...
Hi- I need help reading two rows to an array. I have a list of names in

the first row, columns G:P and a list of numbers in the 10th row, columns
G:P. I want to read in the two rows, and (i think) transpose them before
they are in the array so that they are actually two columns in the array. I
next want to sort them and grab the 5 lowest numbers (and associated names).
I'm fairly confident in VBA for access, but I'm getting a bit thrown off my
this Excel stuff.

I'm aware this is the 2nd time I've posted, but I'm in a bit of a time

crunch. Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Array Help?

Hi Carrie,

Assuming you have sorted your array (vArr) in ascending order and that your
first destination cell is B1, then try:

range("B1").Resize(5,2)=vArr

---
Regards,
Norman

"Carrie" wrote in message
...
Thanks,
I've modified BubbleSort to get it to sort by my first column(numbers),

but also keep my second column (names). Now, how to i output to a 5 x 2
range in Excel, the 5 lowest numbers (and associated names)?

Thanks in advance!



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
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


All times are GMT +1. The time now is 07:13 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"