
05-14-2008, 08:30 PM
|
 |
Senior Contributor
* Expert *
|
|
Join Date: May 2008
Posts: 1,012
|
|
Hi jzd, welcome to the forum!
The formula string to pass must be of the form "=B1" if you want it to refer to the value in cell B1, as opposed to the literal string "B1". So what you need to do in your approach is to - navigate to the next cell, e.g. using .Offset
- get its address, using .Address
- prepend a "=" to that string
There is actually an easier way to do this, though - you can use the INDIRECT worksheet function with a relative R1C1 cell reference, e.g. the formula
Code:
=INDIRECT("R[-1]C",FALSE)
will set a cell equal to the value of the cell above. And since this uses relative coordinates, you can copy the formula to another cell and it'll refer to the cell above that one, without the need for updating the reference. Using that, you can set the conditional formatting for the entire range without the need to loop through the cells.
Hope I didn't misunderstand what you want to do.
|
|