Search code examples
excelvbabutton

VBA - How to change the button text


I assigned an Excel VBA macro to a command button, and I am needing to know how to update the text to "Loading" when the macro is executed.

I have tested the following code with no success:

Worksheets("Sheet1").Button9.Caption = "Loading"

Solution

  • Go via the Buttons collection:

    Worksheets("Sheet1").Buttons("Button9").Text = "Loading"