Hi all,
I am relatively new to programming macros in Excel, but have found VBA relatively straightforward so far.
My problem is this:
I have five columns that have already been sorted (This is for a psychology experiment): Subject #, run #, button press (1 or 2), condition, and onset time (in seconds).
In the column just to the right of these, I am using the following formula to format them:
5 1 1 Directions 0
5 1 1 Directions 180.811
5 1 1 Directions 241.971
Which makes it look something like this, for example:
s5_r1_pp1_Directions=[0 180.811 241.971]
My question is, if there is another block right after that
5 1 1 Directions 0
5 1 1 Directions 180.811
5 1 1 Directions 241.971
5 1 1 Negative 6.089 <----starting here
5 1 1 Negative 24.858
5 1 1 Negative 34.1
5 1 1 Negative 45.912
5 1 1 Negative 186.85
5 1 1 Negative 192.706
5 1 1 Negative 200.213
5 1 1 Negative 293.488
How would I write the code so that it recognizes when the condition column (column 4) changes from "Directions" to "Negative", and formats it accordingly? I'm assuming I would have to use R1C1 notation, and some kind of counter so that it knows how many onsets times are in each condition. That way, it would concatenate the correct number of cells. Note that I would want only one formatted output string for each condition block; for example, one for Directions, and one for Negative.
Desired output:
5 1 1 Directions 0 s5_r1_pp1_Directions=[0 180.811 241.971]
5 1 1 Directions 180.811
5 1 1 Directions 241.971
5 1 1 Negative 6.089 s5_r1_pp1_Negative=[6.089 24.858 34.1 45.912 186.85 192.706 200.213 293.488]
5 1 1 Negative 24.858
5 1 1 Negative 34.1
5 1 1 Negative 45.912
5 1 1 Negative 186.85
5 1 1 Negative 192.706
5 1 1 Negative 200.213
5 1 1 Negative 293.488
Any help is greatly appreciated. Thanks!
-Andrew
Bookmarks