Change Userform CheckBox Caption

gman87

New Member
Joined
Feb 20, 2015
Messages
8
I put together a userform that uses a lot (100+) of check boxes, I have made off the names match what I need them to do but I didn't change the caption to Blank...before I stated to copy

Is there a way to change all checkboxes caption to " "

Userform name is "LoadMaps"

Thanks in advance!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi gman87,

I'm not sure if there is an easy way to permanently change the captions to blank but you can do it when the userform initializes;

Code:
Private Sub UserForm_Initialize()
Dim ctrl As Control
For Each ctrl In Me.Controls
    If TypeName(ctrl) = "CheckBox" Then
        ctrl.Caption = ""
    End If
Next
End Sub

Hope this helps,
Cheers,
Alan.
 
Upvote 0
To change the default caption of all checkboxes to "" (no quotes):
In the VBEditor select all the checkboxes (but no other controls), then use the Properties Window to set the Caption to "" (no quote marks, just delete everything from the input box). That should change all their captions permanently.
 
Last edited:
Upvote 0
You can permanently change the caption by accessing Designer.

In a Standard Module:

Rich (BB code):
Option Explicit
    
Sub temp()
Dim VBProj As Object ' VBIDE.VBProject
Dim VBComp As Object ' VBIDE.VBComponent
Dim Ctl As MSForms.Control
Dim WBName As String
Dim ComponentNameOrIndex As String
  
  WBName = ThisWorkbook.Name
  
  Set VBProj = Application.Workbooks(WBName).VBProject
  
  ComponentNameOrIndex = "LoadMaps"
  Set VBComp = VBProj.VBComponents(ComponentNameOrIndex)
  
  For Each Ctl In VBComp.Designer.Controls
    If TypeName(Ctl) = "CheckBox" Then
      Ctl.Caption = vbNullString
    End If
  Next
  
End Sub

Hope that helps,

Mark

PS. I forget, but you may have to have "Trust Access" ticked.
 
Upvote 0

Forum statistics

Threads
1,216,058
Messages
6,128,532
Members
449,456
Latest member
SammMcCandless

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