Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I have Paste Link copy formating? CarloPel Excel Discussion (Misc queries) 3 January 22nd 10 01:20 AM
??? Copy conditional formating robert morris Excel Discussion (Misc queries) 4 May 7th 07 11:39 PM
[Q] Protecting a formating against Copy Paste Charles Excel Programming 0 September 21st 06 07:58 PM
How do i copy conditional formating formulas from 1 row to rest Rizlaburn Excel Discussion (Misc queries) 1 January 11th 06 09:08 PM
can i freeze conditional formating to copy to another worksheet Chris Lane Excel Discussion (Misc queries) 1 October 12th 05 06:53 PM


All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"