+ Reply to Thread
Results 1 to 9 of 9

VBA Bypass Delete Sheet Warning

  1. #1
    bill_morgan
    Guest

    VBA Bypass Delete Sheet Warning

    Friends,

    I have written VBA code that loops through 150 workbooks and performs
    various tasks on each workbook. One task I need to perform is deleting one
    sheet in each workbook.

    Problem is, the Excel Delete Sheet Warning message box appears before each
    deletion, which means I need to manually confirm the deletion 150 times. Is
    there a VBA way to turn off Excel's delete sheet warning (like there is in
    Access)?

    Thanks for your help ...

    bill morgan



  2. #2
    Jim Thomlinson
    Guest

    RE: VBA Bypass Delete Sheet Warning

    application.displayalerts = false
    sheets("Whatever").Delete
    application.displayalerts = true
    --
    HTH...

    Jim Thomlinson


    "bill_morgan" wrote:

    > Friends,
    >
    > I have written VBA code that loops through 150 workbooks and performs
    > various tasks on each workbook. One task I need to perform is deleting one
    > sheet in each workbook.
    >
    > Problem is, the Excel Delete Sheet Warning message box appears before each
    > deletion, which means I need to manually confirm the deletion 150 times. Is
    > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > Access)?
    >
    > Thanks for your help ...
    >
    > bill morgan
    >
    >


  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Lightbulb

    Sub ..
    Application.DisplayAlerts = False
    'your code here ...
    Application.DisplayAlerts = True
    End Sub

  4. #4
    Gary Keramidas
    Guest

    Re: VBA Bypass Delete Sheet Warning

    something like this

    Sub delsheet()

    Application.DisplayAlerts = False
    Worksheets("sheet3").Delete
    Application.DisplayAlerts = True
    End Sub

    --


    Gary


    "bill_morgan" <[email protected]> wrote in message
    news:[email protected]...
    > Friends,
    >
    > I have written VBA code that loops through 150 workbooks and performs
    > various tasks on each workbook. One task I need to perform is deleting one
    > sheet in each workbook.
    >
    > Problem is, the Excel Delete Sheet Warning message box appears before each
    > deletion, which means I need to manually confirm the deletion 150 times. Is
    > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > Access)?
    >
    > Thanks for your help ...
    >
    > bill morgan
    >
    >




  5. #5
    Ron de Bruin
    Guest

    Re: VBA Bypass Delete Sheet Warning

    Hi Bill

    You can use this

    Application.DisplayAlerts = False
    'Code
    Application.DisplayAlerts = True


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "bill_morgan" <[email protected]> wrote in message news:[email protected]...
    > Friends,
    >
    > I have written VBA code that loops through 150 workbooks and performs
    > various tasks on each workbook. One task I need to perform is deleting one
    > sheet in each workbook.
    >
    > Problem is, the Excel Delete Sheet Warning message box appears before each
    > deletion, which means I need to manually confirm the deletion 150 times. Is
    > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > Access)?
    >
    > Thanks for your help ...
    >
    > bill morgan
    >
    >




  6. #6
    bill_morgan
    Guest

    RE: VBA Bypass Delete Sheet Warning

    Excellent. Thank you, Jim ...

    "Jim Thomlinson" wrote:

    > application.displayalerts = false
    > sheets("Whatever").Delete
    > application.displayalerts = true
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "bill_morgan" wrote:
    >
    > > Friends,
    > >
    > > I have written VBA code that loops through 150 workbooks and performs
    > > various tasks on each workbook. One task I need to perform is deleting one
    > > sheet in each workbook.
    > >
    > > Problem is, the Excel Delete Sheet Warning message box appears before each
    > > deletion, which means I need to manually confirm the deletion 150 times. Is
    > > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > > Access)?
    > >
    > > Thanks for your help ...
    > >
    > > bill morgan
    > >
    > >


  7. #7
    bill_morgan
    Guest

    Re: VBA Bypass Delete Sheet Warning

    So simple! Thanks, Gary ...

    "Gary Keramidas" wrote:

    > something like this
    >
    > Sub delsheet()
    >
    > Application.DisplayAlerts = False
    > Worksheets("sheet3").Delete
    > Application.DisplayAlerts = True
    > End Sub
    >
    > --
    >
    >
    > Gary
    >
    >
    > "bill_morgan" <[email protected]> wrote in message
    > news:[email protected]...
    > > Friends,
    > >
    > > I have written VBA code that loops through 150 workbooks and performs
    > > various tasks on each workbook. One task I need to perform is deleting one
    > > sheet in each workbook.
    > >
    > > Problem is, the Excel Delete Sheet Warning message box appears before each
    > > deletion, which means I need to manually confirm the deletion 150 times. Is
    > > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > > Access)?
    > >
    > > Thanks for your help ...
    > >
    > > bill morgan
    > >
    > >

    >
    >
    >


  8. #8
    bill_morgan
    Guest

    Re: VBA Bypass Delete Sheet Warning

    Thanks, Ron. Everybody giving me the same answer, so must be the BEST way ...


    "Ron de Bruin" wrote:

    > Hi Bill
    >
    > You can use this
    >
    > Application.DisplayAlerts = False
    > 'Code
    > Application.DisplayAlerts = True
    >
    >
    > --
    > Regards Ron de Bruin
    > http://www.rondebruin.nl
    >
    >
    > "bill_morgan" <[email protected]> wrote in message news:[email protected]...
    > > Friends,
    > >
    > > I have written VBA code that loops through 150 workbooks and performs
    > > various tasks on each workbook. One task I need to perform is deleting one
    > > sheet in each workbook.
    > >
    > > Problem is, the Excel Delete Sheet Warning message box appears before each
    > > deletion, which means I need to manually confirm the deletion 150 times. Is
    > > there a VBA way to turn off Excel's delete sheet warning (like there is in
    > > Access)?
    > >
    > > Thanks for your help ...
    > >
    > > bill morgan
    > >
    > >

    >
    >
    >


  9. #9
    bill_morgan
    Guest

    Re: VBA Bypass Delete Sheet Warning

    Thanks, Dave. Glad I asked ... so simple, but would have taken me awhile to
    figure out.

    "davesexcel" wrote:

    >
    > Sub ..
    > Application.DisplayAlerts = False
    > 'your code here ...
    > Application.DisplayAlerts = True
    > End Sub
    >
    >
    > --
    > davesexcel
    > ------------------------------------------------------------------------
    > davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
    > View this thread: http://www.excelforum.com/showthread...hreadid=517423
    >
    >


+ 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