Macro prompt

G

Guest

Hi,

I have a macro that creates a new worksheet, deletes 2 tabs, then closes the
worksheet.

When I run the macro there are 2 prompts,
1-do you want to delete the sheets
2-do you want to save the worksheet.

Is there a way to turn this off so the macro runs more smoothly?

Thanks!
 
G

Guest

Hi Jeff,

Insert
Application.DisplayAlerts = False
before and
Application.DisplayAlerts = True
after line deleting sheets (tabs as you call them), and

ActiveWorkbook.Save
before line closing the workbook (not worksheet).

Regards,
Stefi

„Jeff†ezt írta:
 
R

Rokuro kubi

Jeff said:
Hi,

I have a macro that creates a new worksheet, deletes 2 tabs, then closes the
worksheet.

When I run the macro there are 2 prompts,
1-do you want to delete the sheets
2-do you want to save the worksheet.

Is there a way to turn this off so the macro runs more smoothly?

Thanks!

To close a workbook without being prompted to save
Windows("NAME.xls").Close saveChanges:=False

Funnily enough I was just about to ask how to close tabs without the
save prompt!
 

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

Top