Link to home
Start Free TrialLog in
Avatar of Ray Erden
Ray ErdenFlag for United States of America

asked on

Mutually Exclusive Selection - without radio buttons

Attached file has a sample to describe what I am trying to accomplish.  My goal is to be able to select an option within the group and once the selection is made the rest of the options should become unavailable for selection, basically the same concept with radio buttons.  I could have achieved this using radio buttons in fact this is how it is done currently for the users, but the new requirement is forcing us to eliminate all the control objects from the file, that is all active x controls and form control objects like checkboxes, option buttons, drop downs etc.  In this case I need a logic, code or a setup to simulate what can be accomplished via radio buttons.  On the file there is also a problem description in a box.
C--Users-rerden-Desktop-MF-RFP-Phas.xlsx
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Here's a workbook where Format Cells->Protection and then unchecked "Locked" for the two ranges. I then password protected the sheet (password = "Password") and added this code.
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="Password"
If Not Intersect(Target, Range("H2:H5")) Is Nothing Then
    Range("H2:H5").Locked = True
End If
If Not Intersect(Target, Range("O2:O5")) Is Nothing Then
    Range("O2:O5").Locked = True
End If
ActiveSheet.Protect Password:="Password"

Open in new window

After doing that I selected "Yes" in H4 which caused the code to lock range(H2:H5). You can try it with the other range.
28720582.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ray Erden

ASKER

Thank you!
You're welcome and I'm glad I was able to help. I've attached another way that I rather like. (I only did it for the first set of options). The code in Workbook_Open is not really necessary after the buttons are formatted once.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
28720582b.xlsm