+ Reply to Thread
Results 1 to 7 of 7

Check if a range has data in condition to a cell

  1. #1
    Registered User
    Join Date
    11-17-2010
    Location
    Patras, Greece
    MS-Off Ver
    Excel 2003
    Posts
    11

    Check if a range has data in condition to a cell

    In a sheet a user enters data in a range, say A1 to F5. In column A the user selects an item from a named list (via Data\Validation\List) with text values. Then, in columns B to F the user enters numbers. In any row he may enters 1,2,3,4,5 numbers or none. When he finishes he clicks a button with name 'Confirm' that saves the data and makes some calculations.
    What I want is a macro to run after button click that:
    1) If the user selects a value in A and doesn't enter number in any of the cells that are in the same row (I mean if he leaves a row only with data in A, without at least one number in adjacent cells of columns B to F), a stop explaining message to be appeared and prompt him to correct it.
    2) If the user enters number or numbers in any cell of the range B1 to F5 and omits to select an item in A, again a stop message to be appeared.

    Notice that in all the cells there's Conditional Formatting (font, pattern etc.) with all 3 conditions (Excel 2003).

    Thanks in advance...
    Last edited by agios59; 11-18-2010 at 03:22 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Check if a range has data in condition to a cell

    Can you post a sample workbook?

  3. #3
    Registered User
    Join Date
    11-17-2010
    Location
    Patras, Greece
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Check if a range has data in condition to a cell

    Here is the sample workbook
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Check if a range has data in condition to a cell

    Work this in at the beginning of your button code:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-17-2010
    Location
    Patras, Greece
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Check if a range has data in condition to a cell

    Great! Thank you very much...

  6. #6
    Registered User
    Join Date
    11-17-2010
    Location
    Patras, Greece
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Check if a range has data in condition to a cell

    I now see that if I fill the empty A cell or the cells with numbers the message is appeared again for the next entire empty row. How I ensure that if a row (columns A to F) is empty I may proceed?

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Check if a range has data in condition to a cell

    Slight modification:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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