Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename Excel Check Boxes VB code Please!!! 2

Status
Not open for further replies.

mbernosky

MIS
Jun 24, 2003
4
0
0
US
I have a workbook with over 3,000 check boxes. The are named Check Box 3 - Check Box 3000. I would like to change the name ie. Check Box 3 to chk3_EPO_C14 is there a way to do with in a macro.
Michael

 
what's the naming convention ???
If there's no routine to follow it's gonna be pretty damn hard to do

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Hi,

Something like this ought to work...
Code:
Sub ChangeCkBxNames()
    On Error Resume Next
    For Each ws In Worksheets
        For Each sp In ws.Shapes
            If sp.FormControlType = xlCheckBox Then
                If Err.Number = 0 Then
                    nbr = Right(sp.Name, Len(sp.Name) - 10)
                    sp.Name = "chk" & nbr & "_EPO_C"
                Else
                    Err.Clear
                End If
            End If
        Next
    Next
End Sub
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
guess I did - have one back ;-)

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top