Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Simple Checkbox

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Simple Checkbox

On Jun 6, 4:38*pm, Joel wrote:
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- Hide quoted text -


- Show quoted text -



Firstly Thank you so much for your help.

I have placed three check boxes and clicked "view code" for that
particular sheet where all my checkboxes and run button are located.
However when I click the 'run' button without checking any boxes, it
still does its job. Could you please advise what I did wrong? Do I
need to assign something with those check boxes? How do I activate
those private click subs?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Simple Checkbox

After you enter the macros the 1st time you need to click one of the check
boxes and save the file. After that it should work correctly. the macros
won't work until you click a box.

"James8309" wrote:

On Jun 6, 4:38 pm, Joel wrote:
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- Hide quoted text -


- Show quoted text -



Firstly Thank you so much for your help.

I have placed three check boxes and clicked "view code" for that
particular sheet where all my checkboxes and run button are located.
However when I click the 'run' button without checking any boxes, it
still does its job. Could you please advise what I did wrong? Do I
need to assign something with those check boxes? How do I activate
those private click subs?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Simple Checkbox

On Jun 11, 12:06*pm, Joel wrote:
After you enter the macros the 1st time you need to click one of the check
boxes and save the file. *After that it should work correctly. *the macros
won't work until you click a box.



"James8309" wrote:
On Jun 6, 4:38 pm, Joel wrote:
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- Hide quoted text -


- Show quoted text -


Firstly Thank you so much for your help.


I have placed three check boxes and clicked "view code" for that
particular sheet where all my checkboxes and run button are located.
However when I click the 'run' button without checking any boxes, it
still does its job. Could you please advise what I did wrong? Do I
need to assign something with those check boxes? How do I activate
those private click subs?- Hide quoted text -


- Show quoted text -


Nope, even after

a. Inserting macros into the sheet containing checkboxes and a button.

b. Checking one of the box, saving the file and re opening it.

c. Checking two of the box out of three then hitting the "RUN" button
still works.


I was wondering, if I insert those private subs into the sheet. when I
click those checkboxes, does it automatically pick it up and perform
macro for the button? I have a feeling that your code is good but I am
doing something wrong.

Could you help little bit more?

By the way, hitting the Run button will execute long macro involoving
multiple sheets in the same workbook.

thanks alot
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a simple checkbox that can be checked Phrank Excel Discussion (Misc queries) 4 May 17th 07 06:02 PM
Simple Checkbox Message Code nemadrias Excel Discussion (Misc queries) 10 June 21st 06 08:59 PM
Simple Checkbox Question Tom Ogilvy Excel Programming 3 February 3rd 05 09:04 PM
Simple Checkbox Question Tom Ogilvy Excel Programming 0 February 3rd 05 06:36 PM
Simple hiding columns with vba does not work with a checkbox Brian Excel Programming 3 January 9th 04 10:39 PM


All times are GMT +1. The time now is 08:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"