View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Pasting formats in without conditional formatting?

Try application.DisplayAlerts = False

turn them back on by setting it to true.
--
Regards,
Tom Ogilvy


"TishyMouse" wrote:

Is there a way in VB code to paste the values and formats (colours, borders
and number formats) from copied cells but not paste the conditional
formatting? I am using the following code:

Range(c, c.Offset(0, 17)).Copy
With Range(Sheets(strPSSheet).Cells(intWSPSRow, 1),
Sheets(strPSSheet).Cells(intWSPSRow, 18))
.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.PasteSpecial Paste:=xlPasteFormats

End With
Application.CutCopyMode = False

The problem is that my conditional format in the source range includes a
formula that in turn includes a name so that if I paste two or more ranges
from the source to the target the macro always stops with the message "A
formula or sheet you want to copy includes the name 'MyName' which already
exists on the destination worksheet. Do you want to use this version of the
name? ..." etc..

I guess an alternative would be to prevent the message from appearing. Is
this possible? If I could do this I could just delete the conditional
formatting after the paste.

TIA

TM