Uriel Castillo
New Member
- Joined
- Apr 12, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello everyone.
This is my first time possting, and altough i have some expirience with Excel, i´m relative new to VBA, so i'll be very grateful if you can help with this.
I have a document who looks like this:
The number of rows is always variable, but column D always has percentages, and the sum, excluding the lastrow, it's always 100%. Also, column D it´s always sorted from high to low value.
I want to create a Macro who, from D2, start to sum the values below until the sum it's equal or higher to 80.00 %, and once that condition it's met, change the interior color of that rows to green (RGB (0,255,0)), from A to D.
In my example, the cells who sum 80.00 % or higher are D2 to D6 (87.91%), and the interior color for the range from A2 to D6 will be green (RGB (0,255,0)).
Thank you in advance
This is my first time possting, and altough i have some expirience with Excel, i´m relative new to VBA, so i'll be very grateful if you can help with this.
I have a document who looks like this:
Cedis | Visits | $ | % |
P1 | 7 | $ 355 | 24.58% |
P3 | 2 | $ 319 | 22.10% |
P5 | 4 | $ 291 | 20.16% |
P6 | 2 | $ 158 | 10.95% |
P2 | 2 | $ 146 | 10.12% |
P0 | 1 | $ 124 | 8.62% |
P4 | 1 | $ 29 | 2.01% |
P7 | 1 | $ 21 | 1.46% |
Sum | 20 | $ 1,443 | 100.00% |
The number of rows is always variable, but column D always has percentages, and the sum, excluding the lastrow, it's always 100%. Also, column D it´s always sorted from high to low value.
I want to create a Macro who, from D2, start to sum the values below until the sum it's equal or higher to 80.00 %, and once that condition it's met, change the interior color of that rows to green (RGB (0,255,0)), from A to D.
In my example, the cells who sum 80.00 % or higher are D2 to D6 (87.91%), and the interior color for the range from A2 to D6 will be green (RGB (0,255,0)).
Thank you in advance