PC Review


Reply
Thread Tools Rate Thread

Copying Conditional Formatting Fails

 
 
Henry Stockbridge
Guest
Posts: n/a
 
      13th Dec 2006
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

 
Reply With Quote
 
 
 
 
lesliebantleman@googlemail.com
Guest
Posts: n/a
 
      13th Dec 2006
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


Henry Stockbridge wrote:
> 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


 
Reply With Quote
 
Henry Stockbridge
Guest
Posts: n/a
 
      14th Dec 2006

Simon Lloyd wrote:
> 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
>
>
> --
> Simon Lloyd


------------------------------------------------------

Thanks for the help.

Henry

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Conditional formatting gibbylynn Microsoft Excel Misc 2 25th Jan 2010 05:09 PM
Conditional formatting with strcomp fails terry.bell@optusnet.com.au Microsoft Excel Discussion 3 29th Oct 2008 09:20 AM
Conditional formatting fails on zero value =?Utf-8?B?S2VpdGhT?= Microsoft Excel Crashes 4 12th Jun 2005 04:05 PM
copying conditional formatting =?Utf-8?B?SmFrZ2VlbQ==?= Microsoft Excel Worksheet Functions 2 23rd Dec 2004 05:03 PM
Re: Problems using conditional formatting/copying formatting Norman Harker Microsoft Excel Worksheet Functions 0 5th Aug 2003 09:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:48 AM.