ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Formatting - (https://www.excelbanter.com/excel-programming/310173-conditional-formatting.html)

ronmccpormick

Conditional Formatting -
 
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?

tod

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?
.


No Name

Conditional Formatting -
 
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.

-----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?
.



All times are GMT +1. The time now is 02:26 PM.

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