Home > Enterprise >  Change Alt Text for Multiple Form Control Checkboxes
Change Alt Text for Multiple Form Control Checkboxes

Time:02-22

Is there a way to update the alt text for multiple form control checkboxes at once using Excel VBA? I have about 20 check boxes on a worksheet {"Sheet1"} (Check Box 1, Check Box 2, ... Check Box 20) and need to change the text for all to = "In Progress". Thanks in advance!

CodePudding user response:

"Finding and Replacing in Text Boxes

by Allen Wyatt (last updated July 20, 2019)

Sub TextBoxReplace() Dim shp As Shape Dim sOld As String Dim sNew As String

'Change as desired
sOld = "Old string"
sNew = "New string"
On Error Resume Next
For Each shp In ActiveSheet.Shapes
    With shp.TextFrame.Characters
        .Text = Application.WorksheetFunction.Substitute( _
          .Text, sOld, sNew)
    End With
Next

End Sub

This macro steps through all the shapes in the worksheet (text boxes are shapes) and then replaces whatever is in the sOld variable with whatever is in the sNew variable."

From excelribbon.tips.net

CodePudding user response:

Disregard; I found a solution! ^_^

https://excelribbon.tips.net/T009264_Finding_and_Replacing_in_Text_Boxes.html

  • Related