ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro prompt (https://www.excelbanter.com/excel-discussion-misc-queries/111961-macro-prompt.html)

Jeff

Macro prompt
 
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!

Stefi

Macro prompt
 
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:

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!


Rokuro kubi

Macro prompt
 

Jeff wrote:

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!



All times are GMT +1. The time now is 03:40 PM.

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