PC Review


Reply
Thread Tools Rate Thread

Assigning a Macro to Checkbox on a worksheet

 
 
Corey
Guest
Posts: n/a
 
      11th Apr 2008
I am having difficulty assigning a small macro to a checkbox i have on a sheet.

I right click on the checkbox to assign a macro and have this :

Sub checkbox10_click()

End Sub

I simply want a basic ocurance such as:

If the checkbox is TICKED then Range("C32").value = "Hello" and Range("C33").value = "Goodbye"

Else if the Checkbox is NOT TICKED then both C32 and C33 to be empty (="")


I cannot get the correct syntax for the checkbox??

Corey....



 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      11th Apr 2008
hi
try this.....
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Range("C32").Value = "Hello"
Range("C33").Value = "Goodbye"
Else
Range("C32").Value = ""
Range("C33").Value = ""
End If
End Sub

regards
FSt1
"Corey" wrote:

> I am having difficulty assigning a small macro to a checkbox i have on a sheet.
>
> I right click on the checkbox to assign a macro and have this :
>
> Sub checkbox10_click()
>
> End Sub
>
> I simply want a basic ocurance such as:
>
> If the checkbox is TICKED then Range("C32").value = "Hello" and Range("C33").value = "Goodbye"
>
> Else if the Checkbox is NOT TICKED then both C32 and C33 to be empty (="")
>
>
> I cannot get the correct syntax for the checkbox??
>
> Corey....
>
>
>
>

 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      11th Apr 2008
You don't tell us what checkbox contol you are using.
So if your using a forms control checkbox this should work
Private Sub CheckBox1_Click()
If [Check Box 1].Value > 0 Then
Range("C32").Value = "Hello"
Range("C33").Value = "Goodbye"
End If
If [Check Box 1].Value < 0 Then
Range("C32").Value = ""
Range("C33").Value = ""
End If
End Sub

"Corey" wrote:

> I am having difficulty assigning a small macro to a checkbox i have on a sheet.
>
> I right click on the checkbox to assign a macro and have this :
>
> Sub checkbox10_click()
>
> End Sub
>
> I simply want a basic ocurance such as:
>
> If the checkbox is TICKED then Range("C32").value = "Hello" and Range("C33").value = "Goodbye"
>
> Else if the Checkbox is NOT TICKED then both C32 and C33 to be empty (="")
>
>
> I cannot get the correct syntax for the checkbox??
>
> Corey....
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning checkbox weight (score) in a form sboegeman via AccessMonster.com Microsoft Access Form Coding 4 2nd Mar 2007 05:24 AM
Assigning checkbox to the cell =?Utf-8?B?ZmJhZ2lyb3Y=?= Microsoft Excel Programming 5 15th Feb 2007 04:07 AM
assigning value for unbound checkbox astro Microsoft VB .NET 3 14th Nov 2005 01:53 PM
Assigning a macro to a worksheet (vs personal.xls) Bridget Microsoft Excel Programming 7 18th May 2004 03:56 AM
Assigning click event to OleObjects checkbox =?Utf-8?B?SmltIE1jTGVvZA==?= Microsoft Excel Programming 5 20th Apr 2004 07:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:01 PM.