![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Philippines
Posts: 55
|
Hi there
I try to have a macro delete Shhet1 in a workbook (being the active sheet) and add a new one, name it "sheet1" and select cell"A1". It works fine, but it always gives me the message "The sheet will be deleted permanently" with the choice of accepting or not. Now since this macro is embedded in a long code, it interrupts the running of the operation and requires user input. How to avoid?? Hans |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Philippines
Posts: 55
|
Sorry, here is the code of that Delete/Add macro
Sub RenewSheet2() ' ' RenewSheet2 Macro ' Macro recorded 4/8/2002 by Hans ' ' Application.EnableEvents = False ActiveWindow.SelectedSheets.Delete Sheets.Add ActiveSheet.Name = "Sheet1" Range("A1").Select Application.EnableEvents = True End Sub |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi Hans,
In your code, also include the line Application.DisplayAlerts = False so the message won't pop up. Set is back to true at the end of the procedure. HTH, Jay |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Philippines
Posts: 55
|
Jay,
Problem solved! Thanks a lot. Hans |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|