PDA

View Full Version : Solved: How to suppress replacing cells when using PasteSpecial?



RockMechMark
10-03-2012, 10:14 AM
I perform the following in a Do loop:
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Each time the loop comes to this statement, execution of the subroutine pauses and a window with Yes/No buttons pops up. The question in the window is "Do you want to replace the contents of the destination cells?"

My answer is always yes, but I want this macro to execute unattended. I have not found a setting yet that will suppress this pause and the question. I ask for assistance from the VBA world. You are great.

Mark

xld
10-03-2012, 01:29 PM
Put

Application DisplayAlerts = False

before the loop, and

Application DisplayAlerts = True

after it

RockMechMark
10-04-2012, 06:33 AM
When I put a period between "Application" and "DisplayAlerts", your solution works.

Thanks so much.

Mark

xld
10-04-2012, 03:32 PM
I wonder what happened there?

RockMechMark
10-04-2012, 04:12 PM
Your statements did not show the period between "Application" and "DisplayAlerts"--at least not on my screen.

xld
10-05-2012, 01:01 AM
No I can see that, I meant I wonder how I managed to get that wrong, I know it should be dot not space :(.

jolivanes
10-05-2012, 08:45 AM
Tanslated from Latin into English it says:
"Slip of the finger"