PasteSpecial with Conditional Formats

pergo

New Member
Joined
Apr 2, 2011
Messages
7
Hey All,

I was wondering if it's possible to have PasteSpecial paste conditional formats. I have a range that's background color changes when it's values are within a certain range. I am copying that range to an e-mail, but when it is pasted in the e-mail, the formatted color changes.

Is there anyway to copy the conditional formatted results as well?

Below is the code I have for the copying/pasting portion:

rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With

Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Wouldn't copying as a picture be more suitable in that case?
 
Upvote 0
Is that something possible? That would definitely work.

Could you direct me to how to code that?

Thanks! :D
 
Upvote 0
It'd be like:
Code:
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
    .Range("B16").Select
    .Paste
End With
Application.CutCopyMode = False
... not tested.
 
Upvote 0
Great. Thanks! I'll be able to check and test this tomorrow. Just curious about the B16, was that random or for a reason?
 
Upvote 0
I just tested this and it didn't work. It doesn't seem to copy the range. And it pastes nothing. Any advice?
 
Upvote 0
How are you copying to e-mail.
Copy from Excel, paste into Mail window?

If so, I doubt that the Mail program will respond to Excel's formatting, conditional or otherwise.

You might use the code in this http://www.vbaexpress.com/forum/showthread.php?t=36910 to convert the Conditional Formats into normal formats and send that. (That routine has to be altered for post Excel2003)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top