ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Update Conditional Formatting Formulae (https://www.excelbanter.com/excel-programming/450481-macro-update-conditional-formatting-formulae.html)

Gaura215

Macro to Update Conditional Formatting Formulae
 
Hello

Excel gurus.

I am an amaeture to excel VBA, but I am sure its usage will make my life easier. Actually, there are few spreadsheet in which I applied conditional fomatting. The conditional formatting is based on a formula. However now i realised that I want to change that conditional formatting formula. Is there a way to update it on active spreadsheet using a macro.

Conditional formatting that I want is following:

Applies to $G$6:$M$16
Formula = =IF($L$16<-0.001,IF($L$160.001,0))
I want to change the colour of the applicable range to RED.

Please help.

Thanks to all excel gurus in anticipation.

Regards
Gaurav

Claus Busch

Macro to Update Conditional Formatting Formulae
 
Hi,

Am Wed, 3 Dec 2014 12:31:39 +0000 schrieb Gaura215:

Applies to $G$6:$M$16
Formula = =IF($L$16<-0.001,IF($L$160.001,0))
I want to change the colour of the applicable range to RED.


try:

Range("G6:M16").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=OR($L$16<-0.001,$L$160.001)"

Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.Color = 255
End With

Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com