How to automatically close a messagebox in vba

  • I've got a Macro that I'm working on where depending on what project we are doing, it will format the pages a certain way. After I format it, I use the macro to copy and paste the info across other sheets in the same workbook. Those cells already have data in them.
    The box that pops up says "there is data already here. do you want to replace" options are "yes" or "no". If I want it to select yes automatically, is there a way to do that in the code?

  • Okay I got it. I used the following
    Application.DisplayAlerts = False
    Sheets("Room Inital Component Sheet").Select
    Sheets("Room Final Component Sheet").Select
    Application.DisplayAlerts = True[/VBA]

  • Edited 2 times, last by Carim: Added Code Tags ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!