+ Reply to Thread
Results 1 to 10 of 10

Macro problem on, Yellowed line - previous line or next line.

  1. #1
    Ed
    Guest

    Macro problem on, Yellowed line - previous line or next line.

    In a macro procedure that runs over and over again automatically, then stops
    because of a problem. Then you look at the procedure to debug it and find
    the line the is marked in yellow. Is the problem always in that yellowed
    line or could it be in the next line or in the line preceding?
    Thankyou,
    Ed

  2. #2
    Registered User
    Join Date
    02-19-2004
    Location
    St Louis, MO
    Posts
    13
    Ed,

    I'm almost 100% sure that the line highlighted is always the errored-line.

    JB

  3. #3
    JW
    Guest

    RE: Macro problem on, Yellowed line - previous line or next line.

    Hi Ed,
    It has been my experience that the proble is always in the line that is
    yellowed.

    "Ed" wrote:

    > In a macro procedure that runs over and over again automatically, then stops
    > because of a problem. Then you look at the procedure to debug it and find
    > the line the is marked in yellow. Is the problem always in that yellowed
    > line or could it be in the next line or in the line preceding?
    > Thankyou,
    > Ed


  4. #4
    OJ
    Guest

    Re: Macro problem on, Yellowed line - previous line or next line.

    Hi,
    That's not always true. Sometimes the yellow break will be at the start
    of a function or sub that has been called where the error is in the
    body of the function....If without End If or For without Next....

    OJ


  5. #5
    Ed
    Guest

    RE: Macro problem on, Yellowed line - previous line or next line.



    "JW" wrote:

    > Hi Ed,
    > It has been my experience that the proble is always in the line that is
    > yellowed.
    >
    > "Ed" wrote:
    >
    > > In a macro procedure that runs over and over again automatically, then stops
    > > because of a problem. Then you look at the procedure to debug it and find
    > > the line the is marked in yellow. Is the problem always in that yellowed
    > > line or could it be in the next line or in the line preceding?
    > > Thankyou,
    > > Ed

    Hi JW
    Thanks for the information.
    I guess I always thought the problem was always in the yellowed line.
    My question was prompted by getting an END IF line with the yellow mark.
    Then I couldn't figure out what could be wrong with that line.
    It was spelled correctly and everything.
    Got any comments on that?
    Ed

  6. #6
    gocush
    Guest

    RE: Macro problem on, Yellowed line - previous line or next line.

    do you have 2 End If's for just 1 If statement?

    "Ed" wrote:

    >
    >
    > "JW" wrote:
    >
    > > Hi Ed,
    > > It has been my experience that the proble is always in the line that is
    > > yellowed.
    > >
    > > "Ed" wrote:
    > >
    > > > In a macro procedure that runs over and over again automatically, then stops
    > > > because of a problem. Then you look at the procedure to debug it and find
    > > > the line the is marked in yellow. Is the problem always in that yellowed
    > > > line or could it be in the next line or in the line preceding?
    > > > Thankyou,
    > > > Ed

    > Hi JW
    > Thanks for the information.
    > I guess I always thought the problem was always in the yellowed line.
    > My question was prompted by getting an END IF line with the yellow mark.
    > Then I couldn't figure out what could be wrong with that line.
    > It was spelled correctly and everything.
    > Got any comments on that?
    > Ed


  7. #7
    Bob Phillips
    Guest

    Re: Macro problem on, Yellowed line - previous line or next line.

    The yellowed line is where VBA has a problem in continuing to execute the
    code, it nay not be the line where the problem is. For instance, there is
    nothing intrinsically wrong with this code

    Range("A1").Resize(7,myVar).Select

    but if myVar contains the value 0 will fail. That line will yellow, but the
    problem is where nyVar is set, or not.

    Post your code, and explain what it is doing, and we'll take a look.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Ed" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    > "JW" wrote:
    >
    > > Hi Ed,
    > > It has been my experience that the proble is always in the line that is
    > > yellowed.
    > >
    > > "Ed" wrote:
    > >
    > > > In a macro procedure that runs over and over again automatically, then

    stops
    > > > because of a problem. Then you look at the procedure to debug it and

    find
    > > > the line the is marked in yellow. Is the problem always in that

    yellowed
    > > > line or could it be in the next line or in the line preceding?
    > > > Thankyou,
    > > > Ed

    > Hi JW
    > Thanks for the information.
    > I guess I always thought the problem was always in the yellowed line.
    > My question was prompted by getting an END IF line with the yellow mark.
    > Then I couldn't figure out what could be wrong with that line.
    > It was spelled correctly and everything.
    > Got any comments on that?
    > Ed




  8. #8
    Ed
    Guest

    Re: Macro problem on, Yellowed line - previous line or next line.



    "Bob Phillips" wrote:

    > The yellowed line is where VBA has a problem in continuing to execute the
    > code, it nay not be the line where the problem is. For instance, there is
    > nothing intrinsically wrong with this code
    >
    > Range("A1").Resize(7,myVar).Select
    >
    > but if myVar contains the value 0 will fail. That line will yellow, but the
    > problem is where nyVar is set, or not.
    >
    > Post your code, and explain what it is doing, and we'll take a look.
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Ed" <[email protected]> wrote in message
    > news:[email protected]...
    > >
    > >
    > > "JW" wrote:
    > >
    > > > Hi Ed,
    > > > It has been my experience that the proble is always in the line that is
    > > > yellowed.
    > > >
    > > > "Ed" wrote:
    > > >
    > > > > In a macro procedure that runs over and over again automatically, then

    > stops
    > > > > because of a problem. Then you look at the procedure to debug it and

    > find
    > > > > the line the is marked in yellow. Is the problem always in that

    > yellowed
    > > > > line or could it be in the next line or in the line preceding?
    > > > > Thankyou,
    > > > > Ed

    > > Hi JW
    > > Thanks for the information.
    > > I guess I always thought the problem was always in the yellowed line.
    > > My question was prompted by getting an END IF line with the yellow mark.
    > > Then I couldn't figure out what could be wrong with that line.
    > > It was spelled correctly and everything.
    > > Got any comments on that?
    > > Ed

    >
    >Hi

    Here is a section of my code.

    > Line996:

    If Worksheets("Blackjack").Range("fa13").Value = 2 Or
    Worksheets("Blackjack").Range("fa14").Value = 2 Then

    Worksheets("FastPlay").Range("a1:ew39,bx45:dc45").Calculate
    Else
    Worksheets("FastPlay").Range("a1:ew39").Calculate
    End If 'stopped with yellow on this line.

    If speed = 1 Then Call OneHandOnly 'has also stopped with yellow on this
    line once.
    (end of sample section)

    This sample section is right at the end of this PROCEDURE.
    Processing transfers to this PROCEDURE by a CALL.
    Processing transfers back right after this section shown unless SPEED = 1,
    then it transfers by CALL to ONE HAND ONLY procedure, where processing ends.
    I'm interested in any comments you might have.
    Thankyou,
    Ed

  9. #9
    gocush
    Guest

    Re: Macro problem on, Yellowed line - previous line or next line.

    What happens if you place your cursor inside this procedure, click F8 to step
    into the code, then move directly to this line:

    Worksheets("FastPlay").Range("a1:ew39,bx45:dc45").Calculate

    and click F8 again (bypassing the if clause) ?

    You may have a problem with some kind of Calculation loop that is too long
    or hangs for some reason.

    "Ed" wrote:

    >
    >
    > "Bob Phillips" wrote:
    >
    > > The yellowed line is where VBA has a problem in continuing to execute the
    > > code, it nay not be the line where the problem is. For instance, there is
    > > nothing intrinsically wrong with this code
    > >
    > > Range("A1").Resize(7,myVar).Select
    > >
    > > but if myVar contains the value 0 will fail. That line will yellow, but the
    > > problem is where nyVar is set, or not.
    > >
    > > Post your code, and explain what it is doing, and we'll take a look.
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Ed" <[email protected]> wrote in message
    > > news:[email protected]...
    > > >
    > > >
    > > > "JW" wrote:
    > > >
    > > > > Hi Ed,
    > > > > It has been my experience that the proble is always in the line that is
    > > > > yellowed.
    > > > >
    > > > > "Ed" wrote:
    > > > >
    > > > > > In a macro procedure that runs over and over again automatically, then

    > > stops
    > > > > > because of a problem. Then you look at the procedure to debug it and

    > > find
    > > > > > the line the is marked in yellow. Is the problem always in that

    > > yellowed
    > > > > > line or could it be in the next line or in the line preceding?
    > > > > > Thankyou,
    > > > > > Ed
    > > > Hi JW
    > > > Thanks for the information.
    > > > I guess I always thought the problem was always in the yellowed line.
    > > > My question was prompted by getting an END IF line with the yellow mark.
    > > > Then I couldn't figure out what could be wrong with that line.
    > > > It was spelled correctly and everything.
    > > > Got any comments on that?
    > > > Ed

    > >
    > >Hi

    > Here is a section of my code.
    >
    > > Line996:

    > If Worksheets("Blackjack").Range("fa13").Value = 2 Or
    > Worksheets("Blackjack").Range("fa14").Value = 2 Then
    >
    > Worksheets("FastPlay").Range("a1:ew39,bx45:dc45").Calculate
    > Else
    > Worksheets("FastPlay").Range("a1:ew39").Calculate
    > End If 'stopped with yellow on this line.
    >
    > If speed = 1 Then Call OneHandOnly 'has also stopped with yellow on this
    > line once.
    > (end of sample section)
    >
    > This sample section is right at the end of this PROCEDURE.
    > Processing transfers to this PROCEDURE by a CALL.
    > Processing transfers back right after this section shown unless SPEED = 1,
    > then it transfers by CALL to ONE HAND ONLY procedure, where processing ends.
    > I'm interested in any comments you might have.
    > Thankyou,
    > Ed


  10. #10
    Ed
    Guest

    Re: Macro problem on, Yellowed line - previous line or next line.



    "gocush" wrote:

    > What happens if you place your cursor inside this procedure, click F8 to step
    > into the code, then move directly to this line:
    >
    > Worksheets("FastPlay").Range("a1:ew39,bx45:dc45").Calculate
    >
    > and click F8 again (bypassing the if clause) ?
    >
    > You may have a problem with some kind of Calculation loop that is too long
    > or hangs for some reason.
    >
    > "Ed" wrote:
    >
    > >
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > The yellowed line is where VBA has a problem in continuing to execute the
    > > > code, it nay not be the line where the problem is. For instance, there is
    > > > nothing intrinsically wrong with this code
    > > >
    > > > Range("A1").Resize(7,myVar).Select
    > > >
    > > > but if myVar contains the value 0 will fail. That line will yellow, but the
    > > > problem is where nyVar is set, or not.
    > > >
    > > > Post your code, and explain what it is doing, and we'll take a look.
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Ed" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > >
    > > > >
    > > > > "JW" wrote:
    > > > >
    > > > > > Hi Ed,
    > > > > > It has been my experience that the proble is always in the line that is
    > > > > > yellowed.
    > > > > >
    > > > > > "Ed" wrote:
    > > > > >
    > > > > > > In a macro procedure that runs over and over again automatically, then
    > > > stops
    > > > > > > because of a problem. Then you look at the procedure to debug it and
    > > > find
    > > > > > > the line the is marked in yellow. Is the problem always in that
    > > > yellowed
    > > > > > > line or could it be in the next line or in the line preceding?
    > > > > > > Thankyou,
    > > > > > > Ed
    > > > > Hi JW
    > > > > Thanks for the information.
    > > > > I guess I always thought the problem was always in the yellowed line.
    > > > > My question was prompted by getting an END IF line with the yellow mark.
    > > > > Then I couldn't figure out what could be wrong with that line.
    > > > > It was spelled correctly and everything.
    > > > > Got any comments on that?
    > > > > Ed
    > > >
    > > >Hi

    > > Here is a section of my code.
    > >
    > > > Line996:

    > > If Worksheets("Blackjack").Range("fa13").Value = 2 Or
    > > Worksheets("Blackjack").Range("fa14").Value = 2 Then
    > >
    > > Worksheets("FastPlay").Range("a1:ew39,bx45:dc45").Calculate
    > > Else
    > > Worksheets("FastPlay").Range("a1:ew39").Calculate
    > > End If 'stopped with yellow on this line.
    > >
    > > If speed = 1 Then Call OneHandOnly 'has also stopped with yellow on this
    > > line once.
    > > (end of sample section)
    > >
    > > This sample section is right at the end of this PROCEDURE.
    > > Processing transfers to this PROCEDURE by a CALL.
    > > Processing transfers back right after this section shown unless SPEED = 1,
    > > then it transfers by CALL to ONE HAND ONLY procedure, where processing ends.
    > > I'm interested in any comments you might have.
    > > Thankyou,
    > > Ed


    Hi gocush
    The answer to your question is -
    The yellow jumps directly to the END IF line.
    Judging from what it does on the other lines, it looks right to me.
    The IF condition was met so, the calculation before the ELSE line was
    performed. and the calculation after the ELSE line was skipped.
    When I set it so that the IF condition was not met, it skipped the first
    calculation and performed the condition after the ELSE line.
    Looks right to me.
    Remember, this stopping on the END IF line does not occur every time.
    Most of the time it works properly.
    I don't know what a calculation loop is.
    Thankyou
    Ed

+ 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