madelca100
MIS
Hi,
I've seen and used code here that allows me to conditionally set formats for values in a worksheet. (Thanks to all who posted code.)
Currently I use VBA to create a pivot table and change the color of cells (outside of the pivot table) based on its value.
Example: Cell G5, which is not in the pivot table, has this formula: =+e5/f5. If the value is more than 75 the cell background color changes to green; 65-75 yellow; less than 65 red.
After the code executes cell G5 is 74 and yellow. However, if the user changes the layout of the pivot table and the value in G5 changes to 99 the color stays yellow when it should be green.
Using the menu option Format, Conditional Format allows the color to change as the value changes. i.e., the conditional formatting sticks to the cell.
My question: Is there a way to recreate the Format, Conditional Format menu options using VBA? Or is there another way to accomplish this? Because of security concerns I do not want to distribute a worksheet that contains any macros/code.
Any assistance would be greatly appreciated.
mike
I've seen and used code here that allows me to conditionally set formats for values in a worksheet. (Thanks to all who posted code.)
Currently I use VBA to create a pivot table and change the color of cells (outside of the pivot table) based on its value.
Example: Cell G5, which is not in the pivot table, has this formula: =+e5/f5. If the value is more than 75 the cell background color changes to green; 65-75 yellow; less than 65 red.
After the code executes cell G5 is 74 and yellow. However, if the user changes the layout of the pivot table and the value in G5 changes to 99 the color stays yellow when it should be green.
Using the menu option Format, Conditional Format allows the color to change as the value changes. i.e., the conditional formatting sticks to the cell.
My question: Is there a way to recreate the Format, Conditional Format menu options using VBA? Or is there another way to accomplish this? Because of security concerns I do not want to distribute a worksheet that contains any macros/code.
Any assistance would be greatly appreciated.
mike