+ Reply to Thread
Results 1 to 9 of 9

Quick VBA to check a list

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Quick VBA to check a list

    Hi,

    I need a quick VBA code to check a list as per attached and show a message box to flag up if there are any numbers on their own

    ie in the list attached i want a message box to show up because "40" in row 25 is on its own, the rule is that all numbers must be in blocks of 2 or more

    However i would NOT want the vba to ignore the "40" on its own because there is a block of 2 "40's" prior to it, they must be evaluated as individual blocks.

    Let me know what you can do, much appreciated

    Simon

    Check VBA.xlsx

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Quick VBA to check a list

    Try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Quick VBA to check a list

    Great thanks ill give it a go

    I need another vba code to follow on from this one and i know how to "Call" other codes however if there is a number on its own and the message box has appears i DONT want it to continue and call the next code, how do i stop it depending on the conditions

    So:

    If no numbers on their own, no message, call next VBA code

    or

    If a number on its own then show message and on clicking ok DO NOT call next VBA but return to worksheet

    Many thanks

    Simon
    Last edited by Simon.Ward; 02-25-2013 at 11:57 AM.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Quick VBA to check a list

    Add this line:
    Please Login or Register  to view this content.
    below this line:
    Please Login or Register  to view this content.
    This will stop the code after finding the first isolated number and should return you to your sheet.

  5. #5
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Quick VBA to check a list

    ah thats brilliant thank you

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Quick VBA to check a list

    My pleasure.

  7. #7
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Quick VBA to check a list

    Sorry one more quick thing, if i wanted the msg box to show the number of the row above how would i adapt the c.Row??

    I have also adapted your code to show a msg box if it detects a blank row:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Quick VBA to check a list

    duplicated post deleted

  9. #9
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Quick VBA to check a list

    Sorry squash that i worked it out, c.Row-1 , so obvious

+ 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