ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro help (https://www.excelbanter.com/excel-discussion-misc-queries/2691-macro-help.html)

andy

Macro help
 
I have a macro that does certain functions on startup of my worksheet, during
startup it collects info from a main file then pastes that info into the
worksheet. I was wondering if there is a line of code that selects yes when
the message box comes up and asks if you would like to 'replace the contents
of the desination cells'. Also is there a line of code that will select no
when it asks if you would like to save the large amount of information on the
clipboard.



Bob Umlas

Application.Displayalerts will prevent these kinds of messages from popping
up and will "usually" take the action desired.

"andy" wrote in message
...
I have a macro that does certain functions on startup of my worksheet,

during
startup it collects info from a main file then pastes that info into the
worksheet. I was wondering if there is a line of code that selects yes

when
the message box comes up and asks if you would like to 'replace the

contents
of the desination cells'. Also is there a line of code that will select no
when it asks if you would like to save the large amount of information on

the
clipboard.





Nick Hodge

Andy

Application.DisplayAlerts = False

Turn them back on before code exits

If you still get the clipboard one then you could try

Application.CutCopyMode = False

or copy a blank cell

Range("A65536").Copy
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"andy" wrote in message
...
I have a macro that does certain functions on startup of my worksheet,
during
startup it collects info from a main file then pastes that info into the
worksheet. I was wondering if there is a line of code that selects yes
when
the message box comes up and asks if you would like to 'replace the
contents
of the desination cells'. Also is there a line of code that will select no
when it asks if you would like to save the large amount of information on
the
clipboard.






All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com