Push buttons

Copper Contributor
Hi im on win10, Excel version 2102
Is it possible to name a push button based on a Cell that has a dropdown list? I want to make the push button name change dynamically as the name on the Cell changes. How would i di that? Im very new so don't be harsh. Thank you
1 Reply

@jTalon 

Do you want to change the caption of the button, i.e. the text displayed of the button? If so, you can do the following:

Right-click the sheet tab.

Select 'View Cod' from the context menu.

Copy the following code into the worksheet module:

 

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Range("D1"), Target) Is Nothing Then
        Buttons(1).Caption = Range("D1").Value
    End If
End Sub

 

Change both occurrences of D1 to the cell with the dropdown.

Switch back to Excel.

Save the workbook as a macro-enabled workbook (*.xlsm).

Make sure that you allow macros when you open the workbook.

 

See the attached sample workbook.