+ Reply to Thread
Results 1 to 75 of 75

Data validation by row

  1. #1
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Data validation by row

    Cross-posted @ http://forum.chandoo.org/threads/dat...-by-row.35190/
    Cross-posted @ https://www.mrexcel.com/forum/excel-...ation-row.html

    Data validation by row - the purpose of this macro is to 'clean up' a data set by analyzing each row, then submit the data set to an email address. Attached file "data dump" is an example of an unclean data set. Attached file "data validation by row" is the cleaned up result we are trying to achieve.

    1. to either delete the row or to keep the row based on if it includes one of a list of possible values:
    - valid date
    - order:
    - any of the numerical values 12345 thru 12363 as shown in the result file rows 3-21

    2. to pick out the purchase order number which will occur after keyword "order:"

    3. name the file using the purchase order number as the name, automatically email the workbook to an email address and close the workbook without saving.

    4. to include a particular value "fakename" in the subject line of the email.
    Attached Files Attached Files
    Last edited by zextrot; 07-27-2017 at 02:51 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew
    • Will ALL of these rows that contain the numerical values 12345 thru 12363 ALWAYS contain "EA"...if Yes...will ANY other Rows contain "EA"?
    • Will these numerical values 12345 thru 12363 EVER be different?
    • Do you use Outlook as the Email Client?
    • Where does the Email Address come from..."Email ap@fakenamecorp.com"?
    • Which Date should be operative...your Sample File has two?
    • Where does this come from... "include a particular value "fakename" in the subject line of the email"?
    I'll have more questions...
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Will ALL of these rows that contain the numerical values 12345 thru 12363 ALWAYS contain "EA"...if Yes...will ANY other Rows contain "EA"?
    >No they will not always contain EA.

    Will these numerical values 12345 thru 12363 EVER be different?
    >Yes, it could be any numbers and change from one day to the next. These are customer part #s. Each customer will have their own set of unique numbers.

    Do you use Outlook as the Email Client?
    >Yes.

    Where does the Email Address come from..."Email ap@fakenamecorp.com"?
    >This is the customer's email where the "order" is coming from.

    Which Date should be operative...your Sample File has two?
    >The first date.

    Where does this come from... "include a particular value "fakename" in the subject line of the email"?
    >This is so the email that is sent will be easily recognized by the system reading the email.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I'm looking for things that are constant...

    Will the Customer Part Number EVER contain non-numeric characters?
    Will the Customer Part Number ALWAYS contain 5 digits?
    Will the Customer Part Number ALWAYS be in the 3rd position with a space before and after? If yes, will there EVER be spaces within the Customer Part Number?

    Where do I find this...
    This is the customer's email where the "order" is coming from.

  5. #5
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Ultimately I want this macro to be used for many different customers so I was hoping for a fairly dynamic set of code that I could modify a little for each customer's idiosyncrasies.

    However, to answer your questions .. This particular customer will number their lines as you can see in the part number rows they are numbered 1,2,3,4,5 etc with a space, then a longer number, then a space then the customer's part #. And no, the customer's part# will never have spaces within it and will never have letters, only numbers.
    Yes this customer will always order in EA so every part# row will have EA in it.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I have Code that will work for THIS particular Customer. Please attach two or three Data Dump Files that vary from the format of THIS particular Customer File so I can see the differences...use Actual Data if you can...change any identifying information (Customer Name, Customer Number, email addresses, etc.)...

    1 66666666666 12345 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    2 66666666666 12346 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    3 66666666666 12347 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    4 66666666666 12348 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    5 66666666666 12349 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    6 66666666666 12350 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    7 66666666666 12351 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    8 66666666666 12352 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    9 66666666666 12353 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    10 66666666666 12354 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    11 66666666666 12355 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    12 66666666666 12356 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    13 66666666666 12357 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    14 66666666666 12358 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    15 66666666666 12359 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    16 66666666666 12360 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    17 66666666666 12361 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    18 66666666666 12362 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00
    19 66666666666 12363 5000 EA spec stuff, Metal, Type x7, 4−1/2" x .090" x 7/8" $0.99 $2,100.00

  7. #7
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    In the attached files ...

    Example 1: straightforward example
    Example 2: broken lines (rows 43-44 shows where part of the line above got cut off and dumped into these rows)
    Example 3: in this example, the order was more than one page long and you can see page two rows 80-82
    Attached Files Attached Files

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    As far as I can see every Raw Data File you've uploaded has this characteristic...
    Will ALL of these rows that contain the numerical values xxxxx thru xxxxx ALWAYS contain "EA"
    But you've told me this...show me a Raw Data File that meets this...
    No they will not always contain EA.
    I think I know what needs done...no guarantees...

  9. #9
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    The answer I initially gave was based on speaking of universal code. This specific customer will always order with EA.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Let's try this again...

    Will ALL rows of ALL Raw Data Files that contain the numerical values xxxxx thru xxxxx ALWAYS contain "EA".
    • If "Yes" then end of discussion...
    • If "No" then please attach a Raw Data File that exhibits this...

  11. #11
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    yes, for this customer all rows with the numerical value range will always contain EA

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Let's try this again...

    Forget about this Customer...do you have ANY Customers that will not have EA in some or all their Records...if yes, please show me an example of each (some records without EA...all records without EA).

  13. #13
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    I hesitate to answer because these sample sheets are based on this particular customer. Other customers' sheets would be very different. If they did use EA it would be in a different spot and not necessarily within so many characters of the part#. I imagine each customer would take a fresh set of eyes to determine if the same approach is appropriate.

    The EA is a unit of measure. Others that get used might be PC, PAC, PACK, BX, BOX, CS, CASE but as mentioned above, the rest of the sheet would be formatted so differently among different customers.

    For this customer, the EA will be used every time.
    When we get a working code for this customer, the next conversation might be more productive in terms of differences in the code for each.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Sorry Andrew, I misunderstood...so, you're currently looking at a solution for ONLY this Customer...now your responses make sense. I'll get back on it.

  15. #15
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    yes, once we started talking I deferred to your assessment that we should be focusing on just this customer first

  16. #16
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Sorry about the miss-communication...what I was and am asking is to see what the differences are in all your various Customer Data Dumps so I can access the Constants in the Structure of the different Customer Files.

    I'll be wrapping up the Code for your initial Data Dump probably this PM...perhaps tomorrow AM and will post it for your review.

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    This Code in the attached appears to work on the Data Dump Files you uploaded. It will NOT work on Data Dump Files that don't have "EA" in the Part Number Line Items. You'll need to upload Data Dump Files that exhibit that Structure.

    Place all the attached Files in the same Folder. Open Code Book v3.xlsm, click the Button, select a Data Dump File.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Thank you, this appears to work for this customer very well.

    I have a couple of questions:
    1. Curious if the 'button and select file' procedure has an advantage over pasting the code into a macro. (One advantage that comes to mind is the user may not have to have developer option turned on to run this? What advantages were you thinking when you chose to do a button like this?)
    2. How would we make the email automatically send?

  19. #19
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I don't understand your question...
    Curious if the 'button and select file' procedure has an advantage over pasting the code into a macro
    The Code is in a Macro in the Code Book...the Button Fires the Code.

    Regarding this...
    How would we make the email automatically send?
    In Module 1, Sub Email_Sheet(Email As String, PoNo As String, Subj As String) change .Display to .Send
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Typically I would put the code into a module and run a macro from the macro list.
    Here you have the code in a separate code book and hit a button which brings up a dialog box to choose a file. I was just curious what advantages this method might have.

  21. #21
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    In process of testing this code. I have found one issue. I don't think I communicated correctly regarding the email address.
    The email is set up to send to the email address pulled off the spreadsheet data dump. That is the email address of the customer. We actually want to be able to input an email address into the code where the email will send. It will be our own email address.

  22. #22
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    The advantage of having the Code in a "Code Book" is that you don't need to have the Code in each Data Dump File. You could, if you so choose, place the Code in each User's Personal.XLSB.

    Regardless of where the Code resides you can still do this (with modification) if you so choose...
    Typically I would put the code into a module and run a macro from the macro list.

  23. #23
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    I like the code book, it's cool.
    If you can help with the above testing issue I think this code will pass just fine.

  24. #24
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I asked you this back in my Post #2 and received no reply (I think)...
    Where does the Email Address come from..."Email ap@fakenamecorp.com"?
    If you have a Static Email Address it can simply be inserted in the Code here...
    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    The email address I am inputting is giving me a compile error: Expected: end of statement.
    Would this be because the email address has a dash/hyphen in it?

    Ex: someone@abc-xyz.com

    NEVERMIND .. I did not have the quotations.
    Last edited by zextrot; 08-03-2017 at 06:22 PM.

  26. #26
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Quote Originally Posted by zextrot View Post
    The email address I am inputting is giving me a compile error: Expected: end of statement.
    Would this be because the email address has a dash/hyphen in it?

    Ex: someone@abc-xyz.com

    NEVERMIND .. I did not have the quotations.
    Glad you got it sorted...

  27. #27
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  28. #28
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Yes sir i will do that right after testing which is hopefully today.
    Then i will do a separate thread to discuss the dynamic potential of this code.
    Your genius is appreciated.

  29. #29
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    jaslake, i want to test a theory i have regarding the dynamic potential of this code.

    1. How would the code change if we wanted to accept rows with EA or the phrase "Item Number"?
    2. Can we do variable declaration to allow me to alter the code for other spreadsheets that may use other terminology? (Example: PC or "Part Number")

  30. #30
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    You can try the Code in the attached...it's not been tested. I've added a Data Validation Dropdown in Cell B3 for the User to select a Key Word.
    Attached Files Attached Files

  31. #31
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    You'd probably be better served by uploading Raw Data Files that exhibit different scenarios so that we can see what the similarities are...your choice...

  32. #32
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    The dropdown you mentioned in msg #30 is to choose one of a list of values, EA or another choice. When using one value, I would like to be able to modify to whatever one value is unique for that customer.

    Some customers' data sets get split up in the data dump, so to capture all the pertinent rows, I would like the option of two values .. i.e., rows with EA are captured, plus rows with a different value as well, like "Item number" or "Part number" or whatever other value might be unique to that customer's data dump.

  33. #33
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    If this explanation is not sufficient I can do some extra data files. I do have to "de-sensitize" the data which takes some time.

  34. #34
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I'm unable to test without Data Files...I'd only be guessing...I prefer to not guess.

  35. #35
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Hopefully these examples are sufficient to show the need. I want to be able to modify the code to fit the unique situations. The wording changes from one data set to the next, and sometimes an additional trigger in addition to "EA" is needed to grab the necessary rows.

    CITY CORP
    Date [row 3]
    Purchase Order Number [row 4 has the phrase, row 5 has the number]
    EA would grab rows 34 & 38

    DENVER CORP
    Date [row 2]
    PURCHASE ORDER# [row 4 has the phrase, row 5 has the number]
    EA would grab rows 17, 19, 21, 23

    SOUTHERN CORP
    Date [row 4]
    P.O. Number: [row 3 has the phrase, row 13 has the number]
    EACH would grab row 26
    CASE would grab row 28

    WOOD CORP
    Date appears on rows that will already be grabbed so no need to grab date separately
    PO Number: [row 34 has the phrase and the number]
    EA would grab rows 9, 13, 17, 21
    Item number [also needs to be grabbed, i.e., rows 10, 14, 18, 22]

  36. #36
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    FYI .. i found a strange bug. Running the original macro you wrote on several orders from the same customer, the macro worked flawlessly on every one except one one data dump file it kept a row with the customer's PO number. This same line with their web address and PO number appears identically on all their POs, so I do not see a logical reason for this row to have been kept on one file but not the other files.

    The below row is row 19 on several data sets, but the macro only kept it on one:
    www.fakename.com Purchase order: P037009

  37. #37
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Looking at your disparate files nothing comes to mind...
    I want to be able to modify the code to fit the unique situations

  38. #38
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Quote Originally Posted by zextrot View Post
    FYI .. i found a strange bug. Running the original macro you wrote on several orders from the same customer, the macro worked flawlessly on every one except one one data dump file it kept a row with the customer's PO number. This same line with their web address and PO number appears identically on all their POs, so I do not see a logical reason for this row to have been kept on one file but not the other files.

    The below row is row 19 on several data sets, but the macro only kept it on one:
    www.fakename.com Purchase order: P037009
    Attach the offending File...

  39. #39
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Quote Originally Posted by jaslake View Post
    Hi Andrew

    Looking at your disparate files nothing comes to mind...
    Pinpointing the issue to number of triggers .. if it is not possible to have more than one trigger like the EA in the same macro, what about approaching it where the EA trigger is run in one subroutine to identify or even mark rows to be kept. Then a different trigger set up in a second subroutine. Then a third subroutine comes along and deletes all rows that aren't identified/marked.

  40. #40
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Multiple Triggers is not the issue...Code to handle these inconsistencies is the issue...
    City Corp:
    Purchase Order Number [row 4 has the phrase, row 5 has the number]
    And...
    Denver Corp:
    PURCHASE ORDER# [row 4 has the phrase, row 5 has the number]
    And (even worse)...
    Denver Corp:
    P.O. Number: [row 3 has the phrase, row 13 has the number]
    Not to mention Wood Corp which has...
    Purchase order in Line 30 and
    PO Number: PO000123456 in Line 34

  41. #41
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Quote Originally Posted by jaslake View Post
    Hi Andrew

    Multiple Triggers is not the issue...Code to handle these inconsistencies is the issue...
    Ok if we forget about one code to handle different scenarios and go back to the concept of separate subroutines each running a trigger, that would allow more than one trigger to be run on a single customer PO.

    Regarding the inconsistencies in the wording of the triggers from one customer to another, I'm thinking I could manually modify the appropriate subroutines to fit the next customer I am working on.

  42. #42
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    As I mentioned, Multiple Triggers is not the issue. The Issue is the inconsistencies in the Raw Data.

    I believe you'd need to Modify the Raw Data...for example, City Corp...

    Before:
    City Corp_Before.jpg

    After:
    City Corp_After.jpg

  43. #43
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Oh .. you are saying that the data dumps have inconsistencies within the same customer? .. sometimes their PO number appears on the same row as the phrase and sometimes the number gets bumped to the next row

  44. #44
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    This is an issue with the Code and how it locates the PO Number...
    sometimes their PO number appears on the same row as the phrase and sometimes the number gets bumped to the next row

  45. #45
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Ok .. how about this approach:

    1. No need to capture date or name the filename anything.
    2. Subroutine to identify/mark rows x, y, z every time (each customer's data set consistently has their name/PO on certain rows. I can modify the code for city corp for example to identify rows 4, 5, and 13 every time. On Denver Corp, i would modify the macro to identify rows 4, 5 and 7 every time)
    3. Subroutine to identify/mark any rows that might contain EA
    4. Subroutine to identify/mark any rows that might contain BX
    5. Subroutine to identify/mark any rows that might contain ITEM NUMBER
    (i can manually add more or fewer of these subroutines and modify the phrase as needed for a particular customer)
    6. Subroutine to only keep identified/marked rows.
    7. Subroutine to email the file to an email address and close the file.

  46. #46
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Been having Internet Issues all day...Spectrum is on my Pole as we speak...I'm looking at it...

  47. #47
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Internet is recovered...working on it...you don't require the Date?

  48. #48
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    correct. i wanted to narrow it down to absolute required data. the date is stamped on the email they send so we are good.
    also not necessary to name the file anything.

  49. #49
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    The Code in the attached "appears" to work on all your Data Dump Files. You'll need to keep the Key Words Worksheet updated as necessary. Please note, KeyWords is a Dynamic Named Range and will automatically update as you Add/Delete Key Words in the Key Words Worksheet.

    There are two UserForms in the attached...
    UserForm1 in which you'll select the Key Word(s) appropriate to the Customer.
    UserForm2 in which you'll provide the Row Number that contains the Customer Name and the Row Number(s) of the Purchase Order Information.

    Let me know of issues.

    Edit...Please Note Key Words are case sensitive...
    Attached Files Attached Files
    Last edited by jaslake; 08-18-2017 at 03:51 PM.

  50. #50
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Forgive any ignorance I display here.
    If I understand correctly, this is set up so that it has to be run on every PO that comes in.
    I'm wanting to use it as a 'code generator' .. so that for customer "X" I can choose what is needed in the userforms, then the customized macro code is generated for that specific customer. Then we just run the macro on that customer every time so we don't have to go thru all the steps each time.

  51. #51
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    What are the Constants for the given Customers (A thru Z):
    • Key Word(s)
    • PO Line No 1
    • PO Line No 2 (if any)

  52. #52
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    A given customer .. say woodcorp, or customer "X" .. we would identify that customer's constants. All of Woodcorp's POs would be formatted consistently on the header, but will change on the rows with EA, BX, etc. I believe your codebook achieves that. The userform1 selects the key words appropriate for customer X, userform2 selects the constant rows in their header.

    I want to go thru this selection process just like you have it, but instead of running the codebook against every PO that comes in for customer X .. I want my selections to generate a customer X macro code that is a customized macro for customer X. Now when customer X's POs come in, we just run their customized macro so we don't have to go thru the selection process every time.

    If the customer were to ever alter their formatting, we would run thru the selection process again to update their macro.

    If the customized macros show up as buttons in codebook that would be cool. Otherwise just code that can be cut and pasted into my 'personal' file would be sufficient.

  53. #53
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,181

    Re: Data validation by row

    This thread is marked as solved - is it?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  54. #54
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    We started talking about making the initial code more dynamic so the conversation continued.

  55. #55
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,181

    Re: Data validation by row

    Then you might want to remove the solved tag.

  56. #56
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Yes ma'am, done.

  57. #57
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Quote Originally Posted by zextrot View Post
    A given customer .. say woodcorp, or customer "X" .. we would identify that customer's constants. All of Woodcorp's POs would be formatted consistently on the header, but will change on the rows with EA, BX, etc. I believe your codebook achieves that. The userform1 selects the key words appropriate for customer X, userform2 selects the constant rows in their header.

    I want to go thru this selection process just like you have it, but instead of running the codebook against every PO that comes in for customer X .. I want my selections to generate a customer X macro code that is a customized macro for customer X. Now when customer X's POs come in, we just run their customized macro so we don't have to go thru the selection process every time.

    If the customer were to ever alter their formatting, we would run thru the selection process again to update their macro.

    If the customized macros show up as buttons in codebook that would be cool. Otherwise just code that can be cut and pasted into my 'personal' file would be sufficient.
    Hi Andrew...I'm not familiar with the process you describe...sorry...

  58. #58
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    The codebook is essentially generating a macro code. User chooses the constants in the userforms and the resulting customized macro is run on the data set. I just want to be able to capture the resulting code so I don't have to run the codebook against every PO that comes in from customer "X".

    I want to run the codebook against customer "X", capture the code.
    Then run the codebook against customer "Y", capture the code.
    Then run the codebook against customer "Z", capture the code.

    The captured codes are specific to each customer and can be used every time for that customer, so I only have to go thru the codebook userforms once per customer.

  59. #59
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I'm not suggesting this can't be done...I'm suggesting I'm not schooled in this...don't know how...

    I'd suggest you need to develop a tool like this...which I can work with...
    Table.jpg
    Beyond that, I don't know how to help.
    Last edited by AliGW; 08-23-2017 at 09:48 AM. Reason: Unnecessary quotation removed.

  60. #60
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    ok .. can you explain columns C & D please?

  61. #61
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew
    See your Post #35 for an explanation of all Columns.

  62. #62
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    ok I see what the columns are referring to now.
    are you saying if i provide the info in a table form this is doable?

  63. #63
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    With the revised Code, the User will be asked to select a Data Dump File to open (as is currently done). The User will then will be asked to select a Company Name from a List, perhaps a Dropdown. The Code will find, in the table you've provided, the Company Name selected and extract the Key Words and the location of the PO Number information for the selected Company.

    That's my current thinking...will this work for you?

  64. #64
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    The problem is having to run the process on every file that comes in. I'm trying to take out the user doing all the steps on every file. Once we determine the parameters of customer X, those parameters will be the same for every file they send. The user opens the file, hits a shortcut key to run the customer X macro and that file is emailed off and the file closed. User is done at that point.

  65. #65
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    The user opens the file, hits a shortcut key to run the customer X macro and that file is emailed off and the file closed. User is done at that point.
    Then you'll need to tell the Code where to find Customer X Name as the Code has no Clue what the Customer Name is.
    I suppose you could have a Button for each and every Customer...is that really what you're looking for?

  66. #66
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    Another thought...will your Data Dump File Naming Convention ALWAYS be consistent...Company Name ALWAYS following the dash(-)?
    • data dump - city corp.xlsx
    • data dump - denver corp.xlsx
    • data dump - southern corp.xlsx
    • data dump - wood corp.xlsx

  67. #67
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Quote Originally Posted by jaslake View Post
    Hi Andrew

    Another thought...will your Data Dump File Naming Convention ALWAYS be consistent...Company Name ALWAYS following the dash(-)?
    • data dump - city corp.xlsx
    • data dump - denver corp.xlsx
    • data dump - southern corp.xlsx
    • data dump - wood corp.xlsx
    no, these are just names i came up with during desensitization

  68. #68
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Quote Originally Posted by jaslake View Post
    Hi Andrew


    Then you'll need to tell the Code where to find Customer X Name as the Code has no Clue what the Customer Name is.
    I suppose you could have a Button for each and every Customer...is that really what you're looking for?
    If keeping everything in the codebook framework, then yes I am looking for a button for every customer.
    Or if looking at this in the framework of a "code generator," it would produce a text file of macro code that can be pasted into a personal workbook of macros and assigned a shortcut keyboard key and named the customer X macro for example.

  69. #69
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Well, that begs the question...what does your Data Dump File Naming Convention actually look like...can the Company Name be extracted from the Data Dump File Name...consistently?

  70. #70
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    For me, "code generator" is not an option...

  71. #71
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Quote Originally Posted by jaslake View Post
    Well, that begs the question...what does your Data Dump File Naming Convention actually look like...can the Company Name be extracted from the Data Dump File Name...consistently?
    We don't name them; they come in with random filenames. Yes it would be ok to take a value out of the data set and rename the file. I think that's what was happening early on in the conversation and then we dropped it because it was not necessary on our end. I'm curious why you think the filename is a necessary thing?

    Separate button in the codebook for each customer would work great. Code generator isn't necessary.

  72. #72
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I'm trying to eliminate the need for a Button for each Customer...limit it to one Button for all Customers.

    The File Structure of the Data Dump Files are different across Customers...you've assured me that for a given Customer the File Structure is consistent.

    So, we discussed setting up a Reference Table that has the Constants for each given Customer (Posts #59 -> #62). I'm looking for a Hook that will tell the Code which set of Constants to use based on the Customer Name being processed.

    I'm flying blind here as I'm trying to write Code based on Files (or File Names) that don't exist in the real world...a separate Button for each Customer may be the only option unless the Code can determine what Customer Name the User has selected to process.

  73. #73
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Wood Corp will glitch because the header is not at the top where it would be consistent. Let's drop that customer. I've added Gorpey in their place. I've attached here the data dump files to test and the table including a unique identifier for their name.

    Need to be able to make updates to the table, like adding another value BX, PAC etc .. or changing the name value to their real name instead of the desensitized version.
    Attached Files Attached Files

  74. #74
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Data validation by row

    Hi Andrew

    I've attached two Code Book versions. Version 2 is the one I'd suggest as it's easier to maintain...you simply need to keep Sheet Constants updated for each Customer...no Buttons to add.

    There are two Dynamic Named Ranges in Version 2. Maintaining Sheet Constants will maintain these Named Ranges.

    Let me know of issues.
    Attached Files Attached Files

  75. #75
    Registered User
    Join Date
    10-14-2010
    Location
    Stephenville, Texas
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Data validation by row

    Sorry for the delay in responding to this. Partly it is because our company moves slowly. Additionally, we have been trying to make this work out with our system and our goals/objectives for the macro. Unfortunately it is still requiring too much manual processing. If the company would allow hotkey or something it might be different. As things are, we need to go back to the original request which is to create a macro generator that can produce a packaged macro for each customer which can be embedded into our software so that it will run on that customer's orders.

    Do you think we could have more luck getting this done if we post the question in the Commercial Services section?

+ 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. Replies: 3
    Last Post: 06-04-2015, 02:27 PM
  2. [SOLVED] Data Validation: How to clear/delete the content of the cell and not Data Validation List?
    By lukelucky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-07-2015, 09:42 AM
  3. If statement based data validation? Dynamic data validation?
    By bjohnsonac in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-02-2014, 02:12 PM
  4. Replies: 4
    Last Post: 07-03-2014, 02:37 AM
  5. Replies: 4
    Last Post: 12-19-2013, 10:44 AM
  6. Adding Date Data Validation to cells with List Data Validation
    By biggtyme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 09:47 AM
  7. Using Defined Names with Data Validation Depend and Data Validation Multi Select
    By Vinnie Chan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-01-2012, 05:36 PM

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