View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_570_] Leith Ross[_570_] is offline
external usenet poster
 
Posts: 1
Default Disable Object buttons, based on value of other object buttons


Hello Jeffbert,

I am guessing your Object Buttons are Forms Option Buttons. If that is
the case then the following macro should give you the results you
want.

First copy this code to the clipboard using Ctrl + C. Second add a
standard VBA Module to your Workbook and paste the code into it. Right
Click each Option Button and assign this macro to it.

Adding a Module:
1) Open your Workbook and press Alt + F11 to launch the VBA Editor.
2) Press Alt + I to drop down the Insert Menu.
3) Press M to add the Module to the Workbook.
4) Press Ctrl + V to paste the macro code into it.
5) Press Ctrl + S to Save the changes.
6) Press Alt + Q to Quit the VBA Editor and return to Excel

Macro Code:

Code:
--------------------

Public Sub ControlOptions()

Dim ID
Dim OptBtn As Shape

ID = Application.Caller
Set OptBtn = ActiveSheet.Shapes(ID)

With ActiveSheet.Shapes
Select Case OptBtn.Name
Case Is = "Option Button 7"
.Item("Option Button 8").ControlFormat.Enabled = True
.Item("Option Button 9").ControlFormat.Enabled = True
Case Is = "Option Button 10"
.Item("Option Button 8").ControlFormat.Enabled = False
.Item("Option Button 9").ControlFormat.Enabled = False
End Select
End With

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=547617