+ Reply to Thread
Results 1 to 8 of 8

VBA/XP/2000 On Error Resume Next problem.

  1. #1
    Frank McLellan
    Guest

    VBA/XP/2000 On Error Resume Next problem.

    In the office I've written macro in Excel 2000 (Windows 2000) with some
    error handling (On Error Resume Next) - When I run this same macro at home
    Windows XP and Excel 2003 an Error does not resume - I simply get a run time
    error.

    Basically,
    On Error Resume Next

    Select Blank Cells in a range

    If err <> 0 then
    Do something
    Else
    Do something else
    End if

    Is there a difference between XP and 2000 causing this or is there a
    difference the two versions of Excel? And how do I get round this?


  2. #2
    Dave Peterson
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    I think something you didn't share is clearing the error.

    Any chance you have an "On error goto 0" before you inspect the err.number?

    You may want to post the real snippet of the procedure.

    Frank McLellan wrote:
    >
    > In the office I've written macro in Excel 2000 (Windows 2000) with some
    > error handling (On Error Resume Next) - When I run this same macro at home
    > Windows XP and Excel 2003 an Error does not resume - I simply get a run time
    > error.
    >
    > Basically,
    > On Error Resume Next
    >
    > Select Blank Cells in a range
    >
    > If err <> 0 then
    > Do something
    > Else
    > Do something else
    > End if
    >
    > Is there a difference between XP and 2000 causing this or is there a
    > difference the two versions of Excel? And how do I get round this?


    --

    Dave Peterson

  3. #3
    Jim Cone
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    Frank,

    In the VBE, check on the Tools | Options | General (tab).
    Is "Break on All Errors" checked?

    Regards,
    Jim Cone
    San Francisco, USA


    "Frank McLellan" <[email protected]> wrote in
    message news:BEDA38C2.3F09%[email protected]...
    In the office I've written macro in Excel 2000 (Windows 2000) with some
    error handling (On Error Resume Next) - When I run this same macro at home
    Windows XP and Excel 2003 an Error does not resume -
    I simply get a run time error. Basically,

    On Error Resume Next
    Select Blank Cells in a range
    If err <> 0 then
    Do something
    Else
    Do something else
    End if
    Is there a difference between XP and 2000 causing this or is there a
    difference the two versions of Excel? And how do I get round this?


  4. #4
    Frank McLellan
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.


    Yes Jim, the Break on all Errors" is checked.


    *** Sent via Developersdex http://www.developersdex.com ***

  5. #5
    Frank McLellan
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    G'day Dave - No I'm not using On Error Goto 0 anywhere
    The actual code being used is

    Sub PrepareBranch()
    On Error Resume Next

    Columns("A:A").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select <----- ** See Below

    If err <> 0 then
    'Do nothing
    Else
    Selection.FormulaR1C1 = "=R[-1]C1"
    End if
    err = 0

    'more code

    ** I get the Run time 1004 "No Cells Found" here.
    It was also suggested to see if the "Break on all error was checked - it
    is.


    *** Sent via Developersdex http://www.developersdex.com ***

  6. #6
    Dave Peterson
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    Jim wants you to turn that to something else.

    Under Tools|options|General tab
    I have "break on unhandled errors" checked.

    Since you had "break on all errors" checked and the code found an error, it
    broke (breaked?).




    Frank McLellan wrote:
    >
    > Yes Jim, the Break on all Errors" is checked.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***


    --

    Dave Peterson

  7. #7
    Frank McLellan
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    On 19/6/05 09:10, in article [email protected], "Dave
    Peterson" <[email protected]> wrote:

    > Jim wants you to turn that to something else.
    >
    > Under Tools|options|General tab
    > I have "break on unhandled errors" checked.
    >
    > Since you had "break on all errors" checked and the code found an error, it
    > broke (breaked?).
    >
    >
    >
    >
    > Frank McLellan wrote:
    >>
    >> Yes Jim, the Break on all Errors" is checked.
    >>
    >> *** Sent via Developersdex http://www.developersdex.com ***

    Thanks Dave. That was it. I had Excel VBE set to "unhandled" in the office
    but "all" at home.
    Thanks again Dave.


  8. #8
    Dave Peterson
    Guest

    Re: VBA/XP/2000 On Error Resume Next problem.

    I'll accept the thanks for Jim. He's on location filming his next movie. (Oh,
    wait. This isn't the Oscars!)

    Frank McLellan wrote:
    >
    > On 19/6/05 09:10, in article [email protected], "Dave
    > Peterson" <[email protected]> wrote:
    >
    > > Jim wants you to turn that to something else.
    > >
    > > Under Tools|options|General tab
    > > I have "break on unhandled errors" checked.
    > >
    > > Since you had "break on all errors" checked and the code found an error, it
    > > broke (breaked?).
    > >
    > >
    > >
    > >
    > > Frank McLellan wrote:
    > >>
    > >> Yes Jim, the Break on all Errors" is checked.
    > >>
    > >> *** Sent via Developersdex http://www.developersdex.com ***

    > Thanks Dave. That was it. I had Excel VBE set to "unhandled" in the office
    > but "all" at home.
    > Thanks again Dave.


    --

    Dave Peterson

+ 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