+ Reply to Thread
Results 1 to 7 of 7

Need a formula that checks to see if cells are empty

Hybrid View

  1. #1
    Registered User
    Join Date
    10-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    78

    Need a formula that checks to see if cells are empty

    I have multiple cells that are linked to radio buttons. When a radio button is selected the cell linked to it is populated with a number depending on the radio button from a group that is selected. E.g if the first radio button is selected the linked cell is populated with a 1. I have multiple cells linked to multiple groups of radio buttons. If the user attempts to run a piece of code I have created with any of the linked cells are blank because the user did not select a radio button in one of the groups the system crashes. I need a formula that checks if a range of cells is empty and if so does not run the code but instead displays a message box to inform the user. I have given the cells that are linked to the radio buttons a named range they are called "Buttons".
    Last edited by mdovey; 04-30-2014 at 02:58 PM.

  2. #2
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Need a formula that checks to see if cells are empty

    Attach your spreadsheet so that i can see code to modify it.
    Thank those who have helped you by clicking the Star * below their name and please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Need a formula that checks to see if cells are empty

    Try something like this...

        If Application.Count(Range("Buttons")) <> Range("Buttons").Count Then
            MsgBox "One of the options is not selected. ", vbExclamation, "Missing Selection"
        Else
            'your code here
        End If
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    10-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Need a formula that checks to see if cells are empty

    Thank you Alpha that code has the desired result. Also thank you Jesse for being interested in helping out.

  5. #5
    Registered User
    Join Date
    10-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Need a formula that checks to see if cells are empty

    Here is my workbook hope it helps. The order system holds all of the cells that are linked to the radio buttons contained on the brown sheet tabs. Ignore the other things on the order system sheet they just are for the overview page. The cells that are linked are on the left side of the order system page and all have a title above them saying "..... Option Buttons". The continue button to run the code once all radio buttons have been selected can be found on the overview page (it is big and blue).

    NextGen buttons.xlsm

  6. #6
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Need a formula that checks to see if cells are empty

    Rats. Good job Alpha. I am glad he got you the answer you needed.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Need a formula that checks to see if cells are empty

    Hello mdovey,

    Add this line of Code to the Code that runs your big and blue button.

    If Application.WorksheetFunction.CountA(Range("Buttons")) = 0 Then 'You may change the count to suit
    MsgBox "You MUST make at least one selection in "Order System" before you may continue", vbOKOnly, ("Checking Data Integrity")
    End If
    Sorry, but I had a long hard day, and cannot sort through all your Code to see exactly where it should go.
    So I'm trying a shortcut here!

    Hope that helps.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

+ 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. [SOLVED] Check if cell is not empty and checks if worksheets already exists
    By rskay14 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2014, 02:40 AM
  2. Replies: 5
    Last Post: 01-12-2013, 12:16 AM
  3. [SOLVED] checks if row is blank, if not puts zero in first cell of row if cell is empty
    By synergio in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-13-2012, 10:19 AM
  4. [SOLVED] Formula which checks whether a string is found in a range and checks 2 criteria
    By liranbo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-30-2012, 05:28 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