Conditional Formatting -

  • Thread starter Thread starter ronmccpormick
  • Start date Start date
R

ronmccpormick

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?
 
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
 
hi,
it is to my understanding that conditional formats can be
copied and pasted. if you use the copy command and use the
pasteall command, this should carried the conditional
formats with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top