VB select OK from a prompt when running a macro

  • Thread starter Thread starter Stig
  • Start date Start date
S

Stig

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.
 
Simply turn of the user prompts with:
Application.DisplayAlerts = False
and then you code will run on without interuption.
 
Try

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


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top