Results 1 to 3 of 3

Stop VBA errors - On error do nothing

Threaded View

ExcelGal Stop VBA errors - On error do... 07-17-2012, 08:51 AM
Kyle123 Re: Stop VBA errors - On... 07-17-2012, 09:13 AM
ExcelGal Re: Stop VBA errors - On... 07-17-2012, 11:39 AM
  1. #1
    Registered User
    Join Date
    10-15-2011
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    49

    Cool Stop VBA errors - On error do nothing

    Hello,

    I need some basic advice on what to do when my VBA code runs into errors..

    I have this bit of code to delete sheets tabs

    Formula: copy to clipboard
    Dim MyCell As Range, MyRange As Range

    Set MyRange = Sheets("AREAS").Range("A2")
    Set MyRange = Range(MyRange, MyRange.End(xlDown))

    For Each MyCell In MyRange


    Application.DisplayAlerts = False
    Sheets(MyCell.Value).Delete
    Application.DisplayAlerts = True


    Next MyCell


    When the sheet tabs are not there to delete I want it to not come up with an error.

    I thought the code would be something like on error do nothing

    Can someone help with what to put that I could use in other code too to just make the code not error and whether to put the code where the error occurs or at the end?

    Thanks in advance to anybody who can assist
    Last edited by ExcelGal; 07-17-2012 at 08:53 AM.

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