• Hi all,

    I use the following macro to create a series of commandbuttons:

    I want to have a button name (strButtonname) the same as the Selection.Characters.text. But when I select the new button on my sheet excel named the new buttons as “button 2” “button 3”…
    What did I do wrong?


  • Re: shapes

    The code at the end of your macro is not running, due to the On Error Resume Next.

    If you remove that line, then ActiveSheet.Shapes(strButtonname).Select will error.

    What you have not done is set the Name property of the button. I would do this by creating an Object variable and setting this to your new button. You can then refer to the button using the variable and set the relevant properties. The following is a small example that should get you started.



    ps I would only start to put error handling in when you are happy that the code is working as expected.

  • Re: shapes

    Hi Fluppe,

    You where not assigning the button name to the shape.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!