Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    why no stop.... (2000 sr 1)

    in B4 have:
    7500-005686

    and into amacro this:
    If Left(Sheets(i).Range("B4"), 2) <> "45" Or Left(Sheets(i).Range("B4"), 2) <> "65" Then Stop

    why the code no stop?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: why no stop.... (2000 sr 1)

    Stop will cause code execution to pause and display the Visual Basic Editor, just like setting a breakpoint. That is probably not what you want.

    If you want to get out of a For...Next loop, replace Stop with Exit For
    If you want to stop execution of the procedure or function, replace Stop with Exit Sub or with Exit Function, depending on the type of code you have.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: why no stop.... (2000 sr 1)

    As it happens that condition will always return True since the left two characters can never be both "45" and "65" so there is no need for the test!
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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