christchaaya
Board Regular
- Joined
- Apr 5, 2013
- Messages
- 86
Hello everyone. I'm pretty new to VBA even if I already know how to do basic codes. In this case I have the idea but i don't know how to write it down. I'm working on a worksheet with 12k rows actives, and it's all structured as the table i posted below. What i have to do is substract the initial value (green one) to the final value (red one) and divide it to 1.18 ( if column a is 2012 and the value in b is <= 9) or 1.21 ( if column a is 2013 or it's 2012 and the value in b is >9). Then i have to substract to the result the values in column d that have in column c "aa".
The positive thing is that the dividing line is always 2 rows above the initial value and 1 row below the final value so i thought i can make a loop that search in column a for the value "*******" and then with offset make x= initial value , y = final value and make the operations i told before.
ANY IDEA OF HOW I COULD WRITE THIS OR ALSO ALTERNATIVES WAY TO GET THE SAME RESULT ??? HELP IN ADVANCE 
<tbody>
</tbody>
The positive thing is that the dividing line is always 2 rows above the initial value and 1 row below the final value so i thought i can make a loop that search in column a for the value "*******" and then with offset make x= initial value , y = final value and make the operations i told before.
A | B | C | D | E | |
1 | ******* | === | === | === | === |
2 | |||||
3 | 0005PR | 100 | 200 | ||
4 | 2012 | 02 | bb | 10 | 10 |
5 | 2012 | 04 | bb | 20 | 30 |
6 | 2012 | 10 | aa | 20 | 20 |
7 | 2012 | 11 | bb | 15 | 50 |
8 | 2012 | 11 | aa | 25 | 40 |
9 | |||||
10 | 190 | 350 | |||
11 | ******* | === | === | === | === |
12 | |||||
13 | 0009PR | 150 | 320 | ||
14 | 2012 | 02 | bb | 25 | 35 |
15 | 2012 | 05 | bb | 10 | 20 |
16 | 2012 | 05 | bb | 10 | 10 |
17 | 2012 | 10 | bb | 15 | 30 |
18 | 2013 | 01 | aa | 30 | 10 |
19 | |||||
20 | 240 | 425 | |||
21 | ******* | === | === | === | === |
<tbody>
</tbody>