Disabling all pushbuttons

R

Robert Crandal

I added one pushbutton on top of my Sheet1. I then
right-clicked that button and selected "Copy. Next,
I pasted multiple instances of that same button on
Sheet1 up to Sheet12. So, basically, I have many
instances of the same button scattered through
sheets 1 to 12.

What is a good way to disable (and enable) all these
scattered buttons??? Do I need to iterate through
all buttons and disable them one at a time?? How do I
do this?

thank you!
 
J

joel

For Each sht In Sheets
For Each obj In sht.OLEObjects
ObjectType = TypeName(obj.Object)
If ObjectType = "CommandButton" Then
obj.Enabled = False
End If
Next obj
Next sh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top