ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB select OK from a prompt when running a macro (https://www.excelbanter.com/excel-programming/368148-vbulletin-select-ok-prompt-when-running-macro.html)

Stig[_3_]

VB select OK from a prompt when running a macro
 
Hi,

I am writing a VB macro to format a large amount of data in MS Excel
2000.

Part of the macro uses the 'Text to Columns' function, however, when
running the macro the prompt "Do you want to replace the contents of
the destination cells?" appears when the macro gets to the 'Text to
Columns' command in the code.

Is there a way that I can write the macro to always select 'OK' at this
point and keep running.

Thanks in advance, any help is appreciated.


Graham Whitehead

VB select OK from a prompt when running a macro
 
Simply turn of the user prompts with:
Application.DisplayAlerts = False
and then you code will run on without interuption.

"Stig" wrote in message
oups.com...
Hi,

I am writing a VB macro to format a large amount of data in MS Excel
2000.

Part of the macro uses the 'Text to Columns' function, however, when
running the macro the prompt "Do you want to replace the contents of
the destination cells?" appears when the macro gets to the 'Text to
Columns' command in the code.

Is there a way that I can write the macro to always select 'OK' at this
point and keep running.

Thanks in advance, any help is appreciated.




Chip Pearson

VB select OK from a prompt when running a macro
 
Try

Application.DisplayAlerts = False
' your code here
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Stig" wrote in message
oups.com...
Hi,

I am writing a VB macro to format a large amount of data in MS
Excel
2000.

Part of the macro uses the 'Text to Columns' function, however,
when
running the macro the prompt "Do you want to replace the
contents of
the destination cells?" appears when the macro gets to the
'Text to
Columns' command in the code.

Is there a way that I can write the macro to always select 'OK'
at this
point and keep running.

Thanks in advance, any help is appreciated.





All times are GMT +1. The time now is 02:05 PM.

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