I have a range of cells that I want to compare to the cells immediately to the left (meaning I want to compare cell C5 to cell B5). If C5 is less than B5 I want it to turn red. I want to do this for a range of cells. C5:C20 and E5:E20 and G5:G20 etc. I have named this range MyRange. I originally thought I could use the OFFSET function but I get an error.
When I run this code it fails at the .Add line. I assume the problem is with the syntax of Range(MyRange).Offset(0,-1) but I don’t know. Anyone have any idea how to use VBA to set the conditional formatting using a formula by comparing the cell value to the cell to the left? A few notes… The reason I want to use VBA is that the user may select different formulas and the highlighting will change based on the selection (The users can select Percentage or Count or Variance). The vba is kicked off by an Event Procedure (Not sure this makes any difference but thought Id mention it)
Thanks
Bookmarks