+ Reply to Thread
Results 1 to 5 of 5

Check all data entered in table before executing code

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Check all data entered in table before executing code

    On the attached example, I have a table of data in the range of B4:R303.

    What I want to do is add some code before some existing code I have in a command button on the worksheet to check all data has been entered before running the existing code. If the code finds a row with missing data then a message box appears telling the user.

    For example, on the attached file I have data missing in cells H7 and J9, K9 & P9. So, in this instance I would want the message box to appear after clicking the command button and say:

    The Data table is missing:
    Wigan v West Ham: Header 8
    Tottenham v Sunderland: Header 10, Header 11, Header 16

    and when the user presses an 'OK' button on the message box the first cell of missing data (H7) is activated.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Check all data entered in table before executing code

    try this code
    Please Login or Register  to view this content.
    click the star if it solves your problem

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Check all data entered in table before executing code

    Thanks dwint. Your code is a good start but I have a couple of errors at the minute.

    Firstly, I have amended your line

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    I did this because the team names could potentially be part of any missing data. So, now it should just read the match number from column A.

    The errors (maybe caused by my change) are:

    1) If you put data only in column B then the code is stuck in a loop.

    2) The message wants to read the value of the header cells instead of "Header " & column number of table.

    3) MsgBox only seems to appear if there is data in columns B and at least one other column.

  4. #4
    Forum Contributor
    Join Date
    10-02-2012
    Location
    Bumi Nusantara
    MS-Off Ver
    Excel 2010; Excel 2016
    Posts
    136

    Re: Check all data entered in table before executing code

    sorry, for a few days this forum can not access from Indonesia
    try this code
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Check all data entered in table before executing code

    That seems to be working great now. Thanks!

+ 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