View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default HOW DO I GET AN X IN A CELL IN EXCEL TO COME & GO WHEN CLICKED

One way...

Assume you want the X to appear in cell A1.

On the sheet where you want this to happen:

Select the sheet tab
Right click and select View code
Copy/paste the code below into the window that opens:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo Finish
If Target.Address = "$A$1" Then
With Target
If .Value = "X" Then
.Value = ""
Else
.Value = "X"
End If
End With
End If
Finish:
Application.EnableEvents = True
End Sub

Close the VB editor and return to Excel: ALT Q
Or, click the top "X" to close the window

Select cell A1 and the "X" will appear
Select any other cell
Select cell A1 again and the "X" will be removed


--
Biff
Microsoft Excel MVP


"carbetboy" wrote in message
...
i am trying to put a tick box into a spread sheet and have failed
miserably,
any info greatly appreciated