+ Reply to Thread
Results 1 to 14 of 14

Check (validate) repeating sequence

  1. #1
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Check (validate) repeating sequence

    Hello,

    Sorry for the lengthy post, just want to give as much detail as possible!

    I need help writing a macro that will examine column A row by row to make sure a particular repeating sequence of 3 components is maintained (123-123-123 etc). I guess another term you techies would use is “validate”? If a component is missing, then I would like the “missing slot” to be filled in (inserted in proper position) with a predefined value. The sequence is as follows:

    · *** First component: The first row (A1) must contain only a numeric value (example: 123456). If missing, replace missing value with: “000000”


    · ***Second component: The second row (A2) must be alpha-numeric with multiple words (example: 14K 5-DIA S BAR BAND D.75TW) If missing, replace missing value with: “Product Detail”


    · ***Third component: The third row (A3) contains “;QTY” (without the quotes) at end of a numeric/alpha-numeric string (3 examples: $15;QTY OR $1,000;QTY OR size: 16 - $30.35;size:20 - $36.60;size;24 - $43.74;size:30 - $90.10;QTY). NOTICE HOW ALL THE PRICING EXAMPLES END WITH “;QTY”. If missing, replace missing value with: “Pricing of product”


    · The above sequence repeats itself until no more data exists in column A.

    Here is an example of 5 cycles of the sequence:

    (row1)350267
    (row2)14K 8MM FACETED SMOKEY QUARTZ NECKLACE, 18
    (row3)$136.00;QTY

    (row4)350415
    (row5)14K AMBER & FW PEARL FANCY ADJ. NECKLACE, 16"-18
    (row6)$1,454.45;QTY

    (row7)350539
    (row8)14K BLACK PEARL NECKLACE 6- 6.5MM, 16" FRESHWATER
    (row9)size:16 - $30.35;size:20 - $36.60;size:24 - $43.74;size:30 - $90.10;QTY

    (row10)350629
    (row11)14K 3-STRAND NECKLACE W/ PEARL & TURQUOIS (INSIDE 16"/O 18
    (row12)size:16 - $238.00;size:7 - $102.00;QTY

    (row13)351007
    (row14)14KW BLACK TAHITIAN & DIAMOND 3 PEARL NECK 18", 9-12MM,.16CT
    (row15)$754.00;QTY

    (row 16 . . .)This sequence repeats itself until NO MORE data exists in column A.

    So far I have tried this:

    Please Login or Register  to view this content.
    When I delete the forth line (the second item number) and use the given code, ALL the item numbers following the 4th line are changed to "0" AND replaces ALL descriptions below the 4th line with current pricing AND replaces ALL current pricing below the 4th line with the alternate text for pricing (Pricing for Product).

    I am not very good at coding yet. Any help on this would be GREATLY appreciated !

    Thank you!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin,

    Here is a easier way to test the rows. This uses the "Step" method of a "For...Next" loop to skip 3 rows at a time. The "Cells" method is used to access individual cells within the range by row and column number.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    Thank you Leith!

    I get the same problem with this script as I was with the one I sent you?

    When I delete the forth line (the second item number) and use the given code, ALL the item numbers following the 4th line are changed to "0" AND replaces ALL descriptions below the 4th line with current pricing AND replaces ALL current pricing below the 4th line with the alternate text for pricing (Pricing for Product).
    Thank you for your time!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin,

    I am really not seeing where the problem is in your first post and the last one since the macro does not delete any lines when run. Are you manually deleting rows and then running the macro?

  5. #5
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    Quote Originally Posted by Leith Ross View Post
    Hello imimin,

    I am really not seeing where the problem is in your first post and the last one since the macro does not delete any lines when run. Are you manually deleting rows and then running the macro?
    The whole purpose of the script is to check for lines in the sequence (column A) that are missing. Therefore, yes I am deleting rows to check the script for proper operation. Please re-read my initial post for details.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin

    You said in your post this sequence of three checks would be repeated until there was no more data. The implication was there would be no breaks or blanks between the rows of data and you were simply validating for content. Now you want to check for sequential integrity as well. Both can be done, but not by either method already posted. A new macro will need to written to validate the data and the sequencing.

  7. #7
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    Quote Originally Posted by Leith Ross View Post
    Hello imimin

    You said in your post this sequence of three checks would be repeated until there was no more data. The implication was there would be no breaks or blanks between the rows of data and you were simply validating for content. Now you want to check for sequential integrity as well. Both can be done, but not by either method already posted. A new macro will need to written to validate the data and the sequencing.
    I don't know a lot about this, just trying to find some help on doing it. Do you know how to do this?

    Thank you!

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin,

    Yes, I can write the macro for you but I will need some time to code and test it.

  9. #9
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    Quote Originally Posted by Leith Ross View Post
    Hello imimin,

    Yes, I can write the macro for you but I will need some time to code and test it.
    Thank you sir!

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin,

    One more question. What do you want to happen if the sequence is off?

  11. #11
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    I imagine when you say " What do you want to happen if the sequence is off?" you mean if a row is missing in the sequence? Please see below:

    I need help writing a macro that will examine column A row by row to make sure a particular repeating sequence of 3 components is maintained (123-123-123 etc). I guess another term you techies would use is “validate”? If a component is missing, then I would like the “missing slot” to be filled in (inserted in proper position) with a predefined value. The sequence is as follows:

    · *** First component: The first row (A1) must contain only a numeric value (example: 123456). If missing, replace missing value with: “000000”


    · ***Second component: The second row (A2) must be alpha-numeric with multiple words (example: 14K 5-DIA S BAR BAND D.75TW) If missing, replace missing value with: “Product Detail


    · ***Third component: The third row (A3) contains “;QTY” (without the quotes) at end of a numeric/alpha-numeric string (3 examples: $15;QTY OR $1,000;QTY OR size: 16 - $30.35;size:20 - $36.60;size;24 - $43.74;size:30 - $90.10;QTY). NOTICE HOW ALL THE PRICING EXAMPLES END WITH “;QTY”. If missing, replace missing value with: “Pricing of product


    · The above sequence repeats itself until no more data exists in column A. (NOT just the 15 lines I gave in the example).
    Thank you!
    Last edited by imimin; 09-27-2010 at 05:05 PM.

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Check (validate) repeating sequence

    Hello imimin,

    Okay, if needed then a whole row would be inserted and the default data added. Not a problem.

  13. #13
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    Quote Originally Posted by Leith Ross View Post
    Hello imimin,

    Okay, if needed then a whole row would be inserted and the default data added. Not a problem.
    That is correct, thank you!

  14. #14
    Registered User
    Join Date
    08-17-2006
    Posts
    14

    Re: Check (validate) repeating sequence

    I will be processing approx 22,000 rows (and this number varies) with this script and more than 1 row will be missing.
    Last edited by imimin; 09-28-2010 at 11:57 AM.

+ 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