i need a "radio button" -like feature in excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Any help?
 
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
 

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

Back
Top