nrguerrieri
New Member
- Joined
- May 10, 2018
- Messages
- 39
- Office Version
- 365
I need a vba code that will color code the cell based on the cell to the left of it, previously cell (this is a table with say jan 2010 and the cell to the right will be feb 2010 and so forth)
For ex.
A1 and A2 can be any #. So for example A1 says -.79% and A2 says 0.75%. Since A1 to A2 was an increase. the cell in A2 will need to be green (>10% so a2 will need to be dark green - i explain further below)
Rules: The move from jan to feb (a1 to a2) increases It needs to be green (showing an increase). Vice versa, if the cell in a1 is more than a2, A2 needs to autofill color to red. Important to note that the code needs to be written that it is based on only the left adjacent, to the left of it because i need to replicate this in 100 other columns.
More rules. If its green and the increase is less than 10% of the value to the left = light green. If the cell to the right increased more than 10% than the left cell = dark green. Vice Versa as well. If the decrease was not more than 10% a light red, if the decrease was more than a 10% decrease = a darker red
+ if the cell moved either an increase or decrease of more than 50% please make it so there is no autofill = white
See pic for understanding
**Once you create the code I will be able to tailor (in the future) the colors i need and the difference parameters should i feel like changing the rules from like 50% to like 40% for example.
For ex.
A1 and A2 can be any #. So for example A1 says -.79% and A2 says 0.75%. Since A1 to A2 was an increase. the cell in A2 will need to be green (>10% so a2 will need to be dark green - i explain further below)
Rules: The move from jan to feb (a1 to a2) increases It needs to be green (showing an increase). Vice versa, if the cell in a1 is more than a2, A2 needs to autofill color to red. Important to note that the code needs to be written that it is based on only the left adjacent, to the left of it because i need to replicate this in 100 other columns.
More rules. If its green and the increase is less than 10% of the value to the left = light green. If the cell to the right increased more than 10% than the left cell = dark green. Vice Versa as well. If the decrease was not more than 10% a light red, if the decrease was more than a 10% decrease = a darker red
+ if the cell moved either an increase or decrease of more than 50% please make it so there is no autofill = white
See pic for understanding
**Once you create the code I will be able to tailor (in the future) the colors i need and the difference parameters should i feel like changing the rules from like 50% to like 40% for example.