Is there a way to make a checkbox's Caption dynamic

MrTinkertrain

Board Regular
Joined
Feb 7, 2007
Messages
66
Office Version
  1. 365
  2. 2021
Hello Excelgurus,

I've incorporated a bunch of checkboxes in my workbook.
The captions of those checkboxes are the first names of staff members.
I've added those checkboxes manually and I also manually changed the caption to that particular person's first name.

I was wondering if it's possible to make that somewhat more dynamic.
So for example let's say Hank decides to work somewhere else.
The guy that replaces him is a guy named let's say Joe.

Is there a way to make the caption of that particular checkbox change from "Hank" to "Joe" automatically ?

Any help on this would be highly appreciated.
Also if a let's say "non-checkbox"-solution for this is advisable, I'm open for suggestions ;)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello,

Within your worksheet, are you using ActiveX checkboxes or Forms controls ...?
 
Upvote 0
You said you wanted to do this automatically.

Well very little in Excel can be done automatically.

You can run this script and it will do what you want.

Code:
Private Sub CommandButton1_Click()
'Modified  1/23/2019  9:39:54 AM  EST
Dim objCkBox As Object
Dim i As Long
Dim OldName As String
Dim NewName As String
OldName = InputBox("Enter Old name")
NewName = InputBox("Enter New Name")
    For i = 1 To Sheets.Count
    
        With Sheets(i)
            For Each objCkBox In .OLEObjects
                
                If TypeName(objCkBox.Object) = "CheckBox" Then
                    If objCkBox.Object.Caption = OldName Then
                        objCkBox.Object.Caption = NewName
                    End If
                End If
 
            Next objCkBox
 
        End With
    Next
End Sub
 
Last edited:
Upvote 0
Wow, that's a great solution !
Many thanks for this nifty piece of code.
Highly appreciated
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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