Hide Checkbox in Excel using VBA or IF formula?

xrak

New Member
Joined
Feb 4, 2020
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Please Help: How to Hide Checkbox in Excel using VBA or IF formula?

FOR EXAMPLE: IF C23 = “” THAN HIDE CHECK BOX 1
"" means the cell is empty
I want the CHECK BOX 1 to become visible after I write something in the cell C23

THANK YOU IN ADVANCE!!!
 
If I delete data from C23 or C24 - run time error '1004' appears
 

Attachments

  • error.PNG
    error.PNG
    4.3 KB · Views: 22
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Do you have a checkbox called "Check Box 1" on sheet "Exp"?
 
Upvote 0
I always think having a large number of check boxes or other controls on a sheet can cause you difficulties.
It would be a lot easier if we wrote a script that would turn a cell Red if the cell was empty.
You may want to consider that as a easier solution.
If you may like that let me know and I can write you a script that would do that.
 
Upvote 0
Is it posible to change this VBA code to add one more cell and one more box check?
I will do the rest. I just need the sample to work with.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$23" Then
If IsEmpty(Cells(23, 3)) Then
Sheet1.CheckBoxes("Check Box 1").Visible = vbFalse
Else
Sheet1.CheckBoxes("Check Box 1").Visible = vbTrue
End If
End If
End Sub
 
Upvote 0
Here is a a version, @xrak, handling six check boxes:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("C23:C28")) Is Nothing Then
         Dim r As Integer
             For r = 23 To 28
                If IsEmpty(Cells(r, 3)) Then
                   Sheet1.CheckBoxes("Check Box " & r - 22).Visible = vbFalse
                Else
                   Sheet1.CheckBoxes("Check Box " & r - 22).Visible = vbTrue
                End If
            Next r
    End If
End Sub
And to illustrate it in action. It handles multiple cells deleted too, as you can see.
122867.gif
 
Upvote 0
How about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Not Intersect(Target, Range("C23:C73")) Is Nothing Then
      Me.CheckBoxes("Check Box " & Target.Row - 22).Visible = Target.Value <> ""
   End If
End Sub

IT WORKED! I renamed all the checkboxes and your code worked.
Thank you so much for your help! May God bless you for your kindness!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,728
Messages
6,180,596
Members
452,988
Latest member
wcself81

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top