ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disabling all pushbuttons (https://www.excelbanter.com/excel-programming/438487-disabling-all-pushbuttons.html)

Robert Crandal

Disabling all pushbuttons
 
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!



joel[_558_]

Disabling all pushbuttons
 

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 sht


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170670

Microsoft Office Help



All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com