Thread: Simple Checkbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Simple Checkbox

Use these three click functions. Put them in the VBA sheet page where the
check boxes and button are located.

Private Sub CheckBox1_Click()
If ActiveSheet.CheckBox1 = True And _
ActiveSheet.CheckBox2 = True And _
ActiveSheet.CheckBox3 = True Then

ActiveSheet.CommandButton1.Enabled = True
Else
ActiveSheet.CommandButton1.Enabled = False
End If

End Sub
Private Sub CheckBox2_Click()
If ActiveSheet.CheckBox1 = True And _
ActiveSheet.CheckBox2 = True And _
ActiveSheet.CheckBox3 = True Then

ActiveSheet.CommandButton1.Enabled = True
Else
ActiveSheet.CommandButton1.Enabled = False
End If

End Sub
Private Sub CheckBox3_Click()
If ActiveSheet.CheckBox1 = True And _
ActiveSheet.CheckBox2 = True And _
ActiveSheet.CheckBox3 = True Then

ActiveSheet.CommandButton1.Enabled = True
Else
ActiveSheet.CommandButton1.Enabled = False
End If

End Sub

"James8309" wrote:

Hi Everyone,

I have an excel file and I run my macro by clicking on the 'Button'
that I created on the sheet.

i.e. Click 'Run' button on the sheet then it runs my macro


Is it possible for me to actually hook checkboxes and the run button?

e.g. If I have 3 check boxes, User must check those boxes before
running the macro.

is there any better way of doing this? maybe only when all checkboxes
are ticked my run button appears? or blocks otherwise? anything will
help.

I am trying to create this because even though I placed
"INSTRUCTIONS" people wouldn't follow the damn thing and just click
the run button.lol

thanks alot