Macro to choose the max x value and

Closed
Jeff - Oct 9, 2008 at 08:07 AM
 Shandor - Oct 9, 2008 at 09:47 AM
Hello,

I would like to run a macro to choose the maximum x value from 6 SETS OF numbers and the corresponding y value and continue the loop for EVERY OTHER SIX SETS OF NU,MERS AND BRING DOWN THE VALUE FROM 20000 numbers, The idea is to get a spreadshest with 3333 values after filtering the data.

MAX Best Wind(X) DIRECTION(Y)
0.032034483 327.8
0.033035561 315
0.02903125 285.9
0.02903125 306.5
0.034036638 301.8
0.042045259 303.3
0.055059268 304.6
0.039042026 314
0.040043104 303.7
0.033035561 310
0.041044182 302.2
0.036038794 282.9
0.044047414 305.8
0.04604957 304.4
0.051054958 313.4
0.049052802 326.6
0.058062501 327.7
0.072077587 319
0.059063578 323.3
0.077082975 299.6
0.059063578 308.8
Related:

1 response

I'll just warn here, that I suck at VBA. Every macro I write is done brute force. When I totally get stuck I end up here. So here my process of trying to build what you need. I'd like to help more, but this is the best I can offer.

Record a macro of:

open a new worksheet
select a cell and type in: =max(
then select the values on the first worksheet you are interested in
Then type: ) and hit enter
Then I would select the next row down and do it again so you can see how excel references groups of six cells

stop your macro recording

now go find our about ranges and how to utilize them properly
I use this link a lot the get range syntax
http://www.excel-vba.com/vba-excel-lesson-2-6-1-range-cells.htm

Then learn how to do a for statement (you can just type: for and then hit f1 to get help on it in the VBA editor)
this link has an example of a FOR statement
http://www.excel-vba.com/vba-code-2-11-variables.htm

and more stuff here
http://www.excel-vba.com/excel-vba-contents.htm

There are other sites, i generally google what I need.

I find that working it out for myself help me learn the whole VBA faster than just asking question after question.

I know I have not been as helpful as you need, but I find the turnaround on this forum to be slower than I need, so I thought I'd give you a method to work it out on your own.
0