Michi
Michi

Reputation: 5471

Select mulitple objects (buttons) using VBA

I have three buttons in my Excel spreadsheet called Button_01, Button_02 and Button_03.
Now, I want to select all of them and tried to go with the following VBA:

Sub Select_Objects()
Sheet1.Buttons("Button_01").Select
Sheet1.Buttons("Button_02").Select
Sheet1.Buttons("Button_03").Select
End Sub

This VBA only selects each of the buttons one after another so in the end only Button_03 is selected.

What do I need to change in this code so all three buttons remain selected.
The same if I would select them manually with Ctrl?

Upvotes: 0

Views: 145

Answers (1)

David García Bodego
David García Bodego

Reputation: 1090

Try this one:

Sheet1.Shapes.Range(Array("Button_01", "Button_02", "Button_03")).Select

Hope it helps

Upvotes: 1

Related Questions