View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default i need a "radio button" -like feature in excel

How about a double click event?

Try this macro.

Select the sheet where you want this to happen.
Right click on the sheet tab and select View Code
Paste this code into the right side of the window that opens:

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "X" Then
.Value = ""
Else: .Value = "X"
End If
End With
Cancel = True
End If
sub_exit:
Application.EnableEvents = True
End Sub

Hit ALT Q or click on the "X" to close the VBA editor.

Double click in cell A1 and a "X" will appear. Double click again and the
"X" will disappear.

Adjust the range where you want this to happen by changing this line of
code:

If Not Intersect(Target, Range("A1")) Is Nothing Then

For example, if you want the range to be A1:A10:

If Not Intersect(Target, Range("A1:A10")) Is Nothing Then

Biff

"jcarr25" wrote in message
...
I need to be able to click the cell and an "X" will appear or disappear. A
radio button would work, too.

Any help?