+ Reply to Thread
Results 1 to 3 of 3

Delete sheets in VBA without asking me to confirm

Hybrid View

  1. #1
    Registered User
    Join Date
    11-23-2011
    Location
    Barneveld, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Delete sheets in VBA without asking me to confirm

    Hi,

    If I want to delete a sheet, I always get a mesage to confirm this action and it stops the macro untill I give a response.

    "Data may exist in the sheets(s) selected for deletion. To permanently delete the data, press Delete"

    This is the way I currently perform this action:

    ActiveWindow.SelectedSheets.Delete

    JP
    Last edited by jpbalky; 11-30-2011 at 05:11 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Delete sheets in VBA without asking me to confirm

    switch DisplayAlerts off first.

    Application.DisplayAlerts = False
    ActiveWindow.SelectedSheets.Delete
    Application.DisplayAlerts = True
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-23-2011
    Location
    Barneveld, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Delete sheets in VBA without asking me to confirm

    Thanks that worked great. I can even apply this to more items I had, when replacing files when saving a file which already existed. Till now I almost emptied the map first beofre I ran the macro.

    JP

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1