View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Conditional Formatting -

The solution depends on the condition of the formatting.
For example, if it's simply to format the cell if a value
is equal to, greater than, less than, etc. a certain
value, all you have to do is:

'Where A1 has your conditional format
'and A2 is your destination
Range("A1").Copy
Range("A2").PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False

If your conditional format is a formula, pay attention to
the absolutes in the formula. The dollar signs before the
columns and rows will keep those references the same when
you copy the format. So if the formula is:

=$B$1+$B$2=2

meaning to format the cell if the values in B1 and B2 sum
to 2, copying the format will not change the formula. But
this formula:

=B1+B2=2

(no dollar signs) will change so that it is now relavent
to the new location.

Hope that helps,
tod



-----Original Message-----
I wish to copy (programmatically) a range that has

conditional
formatting associated with it, and I want the same

conditional
formatting to appear in the destination range. Is there

an easy way
to do this?
.