Macro prompt

J

Jeff

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!
 
S

Stefi

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!
 
Top