+ Reply to Thread
Results 1 to 9 of 9

Dual Upper and Lower limits Pass/Fail

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Dual Upper and Lower limits Pass/Fail

    Hi, it would be most appreciated if someone could help me with this problem

    With the following code there are to dynamic cell values AJ30 and AL30.
    With each dynamic value there are upper and lower limits. AJ30 is one changeable value with AJ29 as its upper limit and AJ31 as its lower limit.
    The same is for AL30 as the changeable value with AL29 as the Lower limit and AL31 as its upper limit.
    What I would like to happen is, when both changeable values are within their respective limits to display a passed message, if either one or both are outside its limits then I would like to display a failed message with an option to retry or cancel.
    If retry is selected I would like it to continue looping until a pass criteria is met. If Cancel is selected then I would like to close the active workbook.
    What its actually doing is giving the passed message even if one of the changeable values is outside of the limits.
    This is what I have so far: -


    Please Login or Register  to view this content.
    Any help would be appreciated,
    Thanks in advance

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Dual Upper and Lower limits Pass/Fail

    Why do you have an OR in the middle of your IF statement?

  3. #3
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Dual Upper and Lower limits Pass/Fail

    should that been an AND?

    I'm not that great with VBA, i'm still learning.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Dual Upper and Lower limits Pass/Fail

    I'm only going by your question
    if either one or both are outside its limits
    so yes, I reckon it should!

  5. #5
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Dual Upper and Lower limits Pass/Fail

    Thanks the AND worked great, but when I press 'cancel' it just loops the same as 'Retry'

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Dual Upper and Lower limits Pass/Fail

    Once your criteria are met, the loop should terminate. You have only specified what should happen if Retry is selected so you would need to add another clause for Cancel.

  7. #7
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Dual Upper and Lower limits Pass/Fail

    Thanks for your guidance, but I did say I would like the workbook to terminate. would this be done using Else If?
    because I tried this
    Please Login or Register  to view this content.
    When I tried typing the else if code, I get a VBA error message "Compile Error: Expected: expression"

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Dual Upper and Lower limits Pass/Fail

    Maybe try this for the loop bit. But there is nothing in it to vary the value or cell so why would you get a different result if you try it again?
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-20-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Dual Upper and Lower limits Pass/Fail

    The value of that cell changes because it is a mean average of a light output test from graph data, if the light source varies in brightness then this value would change hence the average light Output Cell AJ30 and the peak of the graph cell AL30. thats what the 'call ADC11' part is that is commented out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Upper and lower control limits
    By Dessesbo in forum Excel General
    Replies: 1
    Last Post: 07-13-2012, 12:34 AM
  2. RAND function with upper and lower limits
    By Grimace in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-12-2011, 07:29 PM
  3. If formula with a upper and lower value limits
    By elcasey125 in forum Excel General
    Replies: 3
    Last Post: 04-19-2009, 11:59 PM
  4. Upper/lower control limits?
    By bethcovey@gmail.com in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-25-2006, 11:35 AM
  5. Function for upper and lower control limits?
    By CaptAndy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-29-2006, 10:15 AM

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