View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
rcalvanese rcalvanese is offline
external usenet poster
 
Posts: 9
Default Array / Looping Question

Are you saying that you need to compare col2 to col3 for matching values,
and if they match run a funcion on the values?

If so...

You can increment through col1. Compare the values of col2 & col3. if
col2.Value = col3.Value... Call the function.

There is no need to declare a bunch of ranges. All you need to do is compare
the values that are already in the cells and make a function call if they
match. There is no need to put this information into an array either, unless
you are going to use it elsewhere in the program. If you are going to use it
elsewhere in the program, you can create a Type containing a variable for
each of the 3 values. Then create a dynamic array of that type, and redim
preserve it for each match. This will give you all the matches to use
elsewhere.

Let me know if this is what you are trying to do...

Best Regards,
Bob
"Matt W" wrote in message
oups.com...
Dear All

I am unsure how to proceed with the following challenge. I have a
worksheet with 3 columns (see below). For each group of data with the
same value in the first colum I need to 'capture' that data set and
then run a predefined function on it. I then need to proceed to
'capture' the second group of data and so on. I'm not sure if the
data should be read to an array and if so how to capture it all. My
initial feeble attempts either lost the 1st or last data set and then I
got stuck with the looping.

Thanks
Matt

Col1 Col2 Col3
BH-01 14.8 0.08
BH-01 28.5 0.85
BH-01 42.1 2
BH-01 82.4 19
BH-01 100 38.1
BH-02 14.9 0.08
BH-02 24.2 0.85
BH-02 34.7 2
BH-02 50.7 4.75
BH-03 22.4 0.08
BH-03 31.6 0.15
BH-03 41.2 0.25
BH-03 56.4 0.43
BH-03 81.8 0.85