Dec 10 2018 10:45 AM
Hello,
Does anyone know if it is possible to have the color fill of the cell change each time the number in the cell is changed? For example, I have a macro that changes the date in the cell every time the appointment is rescheduled, so the first time I use the macro in that cell I would want it to be green, and if the date changes again (i.e they reschedule again), I want the cell to then turn orange, and if the date changes again, then I would want it to be red.
Is there a way to include this in the macro that I use to change the date in the cell?
Thanks!
Dec 11 2018 12:39 AM - edited Dec 11 2018 04:02 AM
to do that you need to have a counter which the final user will not be able to see. one option is creating a very hidden sheet (in developer enviroment by changing sheet visibility property to very hidden) and add a counter to a cell and use the same sheet for other settings or a cell that is already hidden or with font color set to white(not a good option as user can accidentally alter the value of that cell if it is not protected and if protected you need to unlock and lock the sheet every time you change the value in that cell). and change the counter every time you change the date value. and format the date cell with whatever color you want. you can also crerate an array for color codes where the counter will be the index number. So only thing you need to chech is if the index number is smaller than the counter and than change the cell color.
Dec 14 2018 12:18 PM
How would I add a counter to the cell in a hidden sheet so that it appears on the sheet that is visible? Sorry, new to excel and just a tad confusing at first.
Dec 16 2018 10:33 PM
sorry I think I have written this comment to totally wrong entry.
You can use a conditional formatting in the first place. so whenever the cell changes Excel automatically formats the cell color.
If you want to include it in the macro so that whenever you change the cell value, InteriorColor property can be used.