![]() |
Conditional Formating Copy/Paste
I am inserting conditional formats on a spreadsheet, but it keeps hanging up
on the first .Add (xlExpression,...) of the below VBA. I am not sure what I am missing. This is what I want it to do. If J2 is less than 60 days from today, hightlight A2:J2 color 34...or if J2 is less than 30 days from today, highlight A2:J2 color 36...or if today is after J2 then highlight A2:J2 color 38. Then copy the formating from row 2 down to the last row of data. With Range("a2:j2").FormatConditions .Delete .Add(xlExpression, , "=and($i2<=(today()+60),$i2(today()+30),$a2<"")" ).Interior.ColorIndex = 34 .Add(xlExpression, , "=and($i2<=(today()+30),$i2(today()),$a2<"")").I nterior.ColorIndex = 36 .Add(xlExpression, , "=and($i4<today(),$a2<"")").Interior.ColorInd ex = 38 End With With Range("a2:j2") .Copy Range("a2:j" & Range("j65536").End(xlUp).Row).PasteSpecial xlPasteFormats End With |
All times are GMT +1. The time now is 06:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com