I wish it could be that simple but I need to use VBA.
Perhaps you could tell us a bit more about this if the following does not solve your problem.
For example, could the Conditional Formatting simply be applied
by the vba?
If vba is being used, where do we get the target value from? Or is it
always 12?
How will the user be providing the tolerance value to the vba? Will it be in a cell? (which cell?) Will the code provide an InputBox? etc
For this suggestion, I have assumed that a table can be determined by starting at cell A1 and expanding until a complete column and row break is encountered.
For now at least I've hard-coded the target value and the tolerance into the macro.
Anyway, give it a try in a
copy of your workbook.
<font face=Courier New><br><SPAN style="color:#00007F">Sub</SPAN> Tolerance()<br> <SPAN style="color:#00007F">Dim</SPAN> a<br> <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, j <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, rws <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, cols <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br> <br> <SPAN style="color:#00007F">Const</SPAN> Tgt <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN> = 12<br> <SPAN style="color:#00007F">Const</SPAN> Tol <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Double</SPAN> = 0.7<br> <br> Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br> <SPAN style="color:#00007F">With</SPAN> Range("A1").CurrentRegion<br> .Cells.Interior.ColorIndex = xlNone<br> a = .Value<br> rws = <SPAN style="color:#00007F">UBound</SPAN>(a, 1)<br> cols = <SPAN style="color:#00007F">UBound</SPAN>(a, 2)<br> <SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> rws<br> <SPAN style="color:#00007F">For</SPAN> j = 1 <SPAN style="color:#00007F">To</SPAN> cols<br> <SPAN style="color:#00007F">If</SPAN> IsNumeric(a(i, j)) <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#00007F">If</SPAN> Abs(Tgt - a(i, j)) > Tol <SPAN style="color:#00007F">Then</SPAN> .Cells(i, j).Interior.ColorIndex = 4<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">Next</SPAN> j<br> <SPAN style="color:#00007F">Next</SPAN> i<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>