Checkbox to change it's own label?

tigger6333

New Member
Joined
Sep 6, 2009
Messages
43
Greetings wise ones

I would love to have a checkbox which, when ticked, changes it's text label to the date.
eg [] Checkbox1 would become [√] 27-4-14

My macro skills are less than basic so I am requesting assistance.

Does anyone know if this can be done and, if so, how?

Thanks
Keith
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
@tigger

Just in case you are reffering to a userform. The below code could help.

Code:
 If (Me.CheckBox1.Value = True) Then
    Me.CheckBox1.Caption = Date
 Else
    Me.CheckBox1.Caption = "CheckBox"
 End If

Cheers
Chard
 
Upvote 0
@tigger

Just in case you are reffering to a userform. The below code could help.

Code:
 If (Me.CheckBox1.Value = True) Then
    Me.CheckBox1.Caption = Date
 Else
    Me.CheckBox1.Caption = "CheckBox"
 End If

Cheers
Chard


Keep in mind that the code will need to be entered into the appropriate Checkbox event. You will also want to consider how you want the date formatted. Me.Checkbox1.Caption = Format(Date,"dd-m-yy")

Oh yeah, if it is a checkbox that is embedded on the worksheet, there are two different checkboxes. One of them is from the Forms toolbox and the other is from...well...some other one. I forgot the toolbox. The two work a little differently.
 
Upvote 0
@phantom

Thanks, I'll keep that in mind. :)

I was actually assuming that tigerr already knew the basic (oh yeah he mentioned less than basic :) ). Well, just in case, I'll add as well the event and date format.

Code:
Private Sub CheckBox1_Click()

 If (Me.CheckBox1.Value = True) Then
    Me.CheckBox1.Caption = Format(Date,"dd-m-yy")
 Else
    Me.CheckBox1.Caption = "CheckBox"
 End If
 
End Sub

Cheers
Chard
 
Upvote 0
Ah, the wisest of the wise have helped.

I appreciate your help and wisdom. I particularly like the Format option too.

Thanks very much.

(bows deeply)
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

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