+ Reply to Thread
Results 1 to 5 of 5

Macro - Logical Order

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Macro - Logical Order

    I am trying to run this macro through my range of data. It seems to work but it doesn't seem to be testing the conditions in the order I have them set up. For example, if you look in the section of "System Checks" a line in my data had S= 03, but instead of giving me "Sys 03..." it gave me "Parts Invoved in Service" because Q = 6501000.
    So, How can I get this macro to check for these conditions in the order I have them set up? Or is there a better macro for this.
    Thank you...

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    My guess is you will find that if you īput a break point or exit sub in after the system check you will find it is correct output
    I am thinking it might be getting overwitten due to the checks in the EPD section where it checks the value in "Q" & i cell
    HTH
    Steve
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I'd use lookup tables and a formula:

    =IFERROR(VLOOKUP(N419, tblAR,2, FALSE),
    IFERROR(VLOOKUP(S419, tblSys, 2, FALSE),
    IFERROR(VLOOKUP(N419, tblHQ, 2, FALSE),
    IFERROR(VLOOKUP(Q419, tblPD, 2, FALSE),
    IFERROR(VLOOKUP(R419, tblDept, 2, FALSE),
    IFERROR(VLOOKUP(N419, tblLoc, 2, FALSE), "???") ) ) ) ) )


    ... and this function
    Please Login or Register  to view this content.
    An example of one of the lookup tables (tblSys) is

    Please Login or Register  to view this content.
    Last edited by shg; 01-28-2008 at 04:31 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    That could be simplified a little to

    =IFERRORS(
    VLOOKUP(N419, tblAR, 2, FALSE),
    VLOOKUP(S419, tblSys, 2, FALSE),
    VLOOKUP(N419, tblHQ, 2, FALSE),
    VLOOKUP(Q419, tblPD, 2, FALSE),
    VLOOKUP(R419, tblDept, 2, FALSE),
    VLOOKUP(N419, tblLoc, 2, FALSE), "???")


    ... using this function instead:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    shg...thank you for the advice...great tip.

+ 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