Copying Conditional Formatting Fails

H

Henry Stockbridge

Hi,

When I attempt to copy the conditional formatting of the following, it
does not copy correctly.

a b c
1 First MI Last
2 Jack M Harris
3 Sally J Smith
4 Bill V Nelson

Cells A2 - C2 have conditional formatting applied to them. I have
attempted to Copy - Paste Special --> Formats, but this code fails:

Range("A1:C1").Select
Selection.Copy
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2:C4").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

I will be calculating the row count via code (I don't have that handy)
so the absolute reference to C4 will be replaced with C & rowcount.

Any help you can lend would be appreciated.

Henry
 
L

lesliebantleman

Hi Henry,

I could be wrong but your code is copying A1:C1 and not A2:C2, which
has the conditional formatting applied to them. Try amending the first
line of code to copy from row 2!

Good luck,

Les Bantleman
 
H

Henry Stockbridge

Simon said:
Thats because when you use conditional formatting your expression looks
something like this > =$A$1=""fred", notice the $ it makes things an absolute reference if your expression
looked like this > =$A1=""fred" it will copy down fine!

Regards,
Simon
 

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

Top