Where is the name of a form Button?

USAMax

Well-known Member
Joined
May 31, 2006
Messages
846
Office Version
  1. 365
Platform
  1. Windows
I have been writing Excel over 10 years and I have never had the need to create a form but I have always used a Form Button.

Now I need to be able to change the name of a form button and I don't know how to get into the form controls.

I know this is a basic question but can someone help me find the button properties?

Dave
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Dave,

This macro will create a new sheet that lists all of the Form button names and locations. That way you can find the one you need to rename.
To rename a button, right-click on it so that it is selected, and then in the upper left where a cell address usually is, you will be able to see the button's name. Just click in there and delete the name then type in the name you want.
Code:
Sub tgr()
    
    Dim ws As Worksheet
    Dim btn As Button
    Dim arrResults(1 To 65000, 1 To 2) As String
    Dim ResultIndex As Long
    
    For Each ws In ActiveWorkbook.Sheets
        For Each btn In ws.Buttons
            ResultIndex = ResultIndex + 1
            arrResults(ResultIndex, 1) = btn.Name
            arrResults(ResultIndex, 2) = ws.Name & "!" & btn.TopLeftCell.Address(0, 0)
        Next btn
    Next ws
    
    If ResultIndex > 0 Then
        With Sheets.Add(After:=Sheets(Sheets.Count))
            With .Range("A1").Resize(, UBound(arrResults, 2))
                .Value = Array("Button Name", "Button Location")
                .Font.Bold = True
                .Borders(xlEdgeBottom).LineStyle = xlContinuous
            End With
            .Range("A2").Resize(ResultIndex, UBound(arrResults, 2)).Value = arrResults
            .UsedRange.EntireColumn.AutoFit
        End With
    Else
        MsgBox "No Form Buttons found in this workbook.", , "No Buttons"
    End If
    
    Set ws = Nothing
    Set btn = Nothing
    Erase arrResults
    
End Sub
 
Upvote 0
There are actually 2 places where "name" applies. The first is the (Name) property. This is the name you refer to when you are calling the button in a vba script. I usually change this to cmdBt1 or some other similar descriptor. The other is in the Caption property. This is where you enter what you want the world to see. For example "Close" or "Begin". You can also use control tip text to further explain yourself. All of these can be found by right clicking on the button and selecting properties.

If you are using the buttons within Excel worksheets, you don't get the same functionality. I am struggling with that also.
 
Upvote 0
I have been writing Excel over 10 years and I have never had the need to create a form but I have always used a Form Button.

Now I need to be able to change the name of a form button and I don't know how to get into the form controls.

I know this is a basic question but can someone help me find the button properties?
To rename a Form's control, select the control (right click it), type its new name into the Name Box (the field to the left of the Formula Bar) and finish off by hitting the Enter key.
 
Upvote 0
FWIW, I find the ActiveX controls much easier to deal with.
 
Upvote 0
There are actually 2 places where "name" applies. The first is the (Name) property. This is the name you refer to when you are calling the button in a vba script. I usually change this to cmdBt1 or some other similar descriptor. The other is in the Caption property. This is where you enter what you want the world to see. For example "Close" or "Begin". You can also use control tip text to further explain yourself. All of these can be found by right clicking on the button and selecting properties.

If you are using the buttons within Excel worksheets, you don't get the same functionality. I am struggling with that also.




Thank you vavs, you understand the problem exactly and detailed it very well. I do not want to change the DISPLAY NAME. but the (Name) property that you refer to when you are calling the button. You said you usually change this so how do you change it. If it is not as easy to do in Excel where do you change it?
 
Upvote 0
Thank you vavs, you understand the problem exactly and detailed it very well. I do not want to change the DISPLAY NAME. but the (Name) property that you refer to when you are calling the button. You said you usually change this so how do you change it. If it is not as easy to do in Excel where do you change it?
I think you missed my earlier message... you might want to read it now (Message #4).
 
Upvote 0
I think you missed my earlier message... you might want to read it now (Message #4).

Thank you Rick but I am not trying to change the display information to say, "Click Here" I am trying to change the name of the button from, "Button 5" to "Button 3".

I have had a number of people who have told me to right click and choose properties but that is not an option in Excel 2010 for the form button within the normal view of Excel. I need to edit the name of the button for programing reasons.
 
Upvote 0
Hi,
Rick did not tell you how to change what the button displays. He described how to change it name (property). Are you sure you are using a forms control as that should work?

At least in Windows, you change a button's name by selecting in the button and retyping a new name in the name box (though for some reason -- a bug? -- I found I could not change a button's name to Button 1). I don't know if Mac is different however so maybe none of this applies to you.

The name box is just at the top left, above A1 and to the left of the formula bar:
<img src="http://northernocean.net/etc/mrexcel/20121215_capture2.jpg" />

In this example, I've changed what was originally Button 1 to now be Button 4.

Note: The right-click/properties solution applies to ActiveX controls, not to Forms controls.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,734
Messages
6,174,189
Members
452,550
Latest member
southernsquid2

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