+ Reply to Thread
Results 1 to 5 of 5

Checkbox hide if cell is blank

  1. #1
    Forum Contributor
    Join Date
    04-17-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    122

    Question Checkbox hide if cell is blank

    Good Afternoon

    I have looked around and tried several different codes posted online but I cant get them to work, What I want to achieve is as follows

    when a cell is blank I want the active x check box not to be visible but when the cell is populated by a formula I want the check box to be visible.

    I have formula in cells B25:B39 and a checkbox next to each row so ideally I need the check boxes hidden on every line until the corresponding line is populated if possible.

    Here's a code I tried as a starting point

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Checkbox hide if cell is blank

    "when a cell is blank I want the active x check box not to be visible but when the cell is populated by a formula I want the check box to be visible."

    If there is a formula in a cell, and the result is blank, the cell is still being populated by the formula, so your description is a little ambiguous.

    Do you mean: There is a formula in the cell. When the result of the formula is the null string, I want the checkbox to be invisible. When the formula produces a non-null result, I want the checkbox to be visible.

    If that's what you mean then set your checkboxes up to be named CheckBox1, CheckBox2, etc.
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    04-17-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: Checkbox hide if cell is blank

    Quote Originally Posted by 6StringJazzer View Post
    "when a cell is blank I want the active x check box not to be visible but when the cell is populated by a formula I want the check box to be visible."

    If there is a formula in a cell, and the result is blank, the cell is still being populated by the formula, so your description is a little ambiguous.

    Do you mean: There is a formula in the cell. When the result of the formula is the null string, I want the checkbox to be invisible. When the formula produces a non-null result, I want the checkbox to be visible.

    If that's what you mean then set your checkboxes up to be named CheckBox1, CheckBox2, etc.
    Please Login or Register  to view this content.
    Appologies yes thats what I mean

    The formula I have is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So I want the checkbox hidden if the formula result returns ""

    I have tried the code you kindly provided for me but I cant seem to get the desired result, maybe i'm being silly.

    I Have attached the workbook

    I get the following error as per screenshots.

    Macro Error.jpg

    Macro Error1.jpg
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Checkbox hide if cell is blank

    Your first post says
    I have formula in cells B25:B39 and a checkbox next to each row
    but you don't have a checkbox in each row. You only have one checkbox in row 25. After the code checks the first checkbox, it looks for CheckBox2, which doesn't exist, so it causes an error.

    Second, this cell is not null, it has a single space, so the code has to be adjusted to take that into account. However, when I make the changes, I am still having trouble getting the control to become invisible. I am stepping through the code and am on a line where it makes the Visible property False but it does not disappear. I am still troubleshooting that.

  5. #5
    Forum Contributor
    Join Date
    04-17-2012
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    122

    Re: Checkbox hide if cell is blank

    Quote Originally Posted by 6StringJazzer View Post
    Your first post saysbut you don't have a checkbox in each row. You only have one checkbox in row 25. After the code checks the first checkbox, it looks for CheckBox2, which doesn't exist, so it causes an error.

    Second, this cell is not null, it has a single space, so the code has to be adjusted to take that into account. However, when I make the changes, I am still having trouble getting the control to become invisible. I am stepping through the code and am on a line where it makes the Visible property False but it does not disappear. I am still troubleshooting that.
    Thanks for the reply, Sorry I made some changes to take out sensitive data so have inadvertently caused the issue. thank you for your help it is appreciated.

+ 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] Macro Checkbox to hide multiple blank rows
    By qiyusi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-22-2014, 11:45 PM
  2. Replies: 2
    Last Post: 04-26-2014, 07:34 PM
  3. [SOLVED] Hide/unhide Cell contents based on checkbox
    By Kelton in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2014, 04:25 PM
  4. Hide Column If Cell Value is empty from Checkbox
    By Guple in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 04:40 AM
  5. IF date in cell is not a workday then hide checkbox
    By renden in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2012, 09:48 AM
  6. Show/Hide columns by checkbox and cell text
    By ksmoore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2010, 02:20 PM

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