Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2000 Enter "x" with the click of a mouse 1

Status
Not open for further replies.

MJamison07

Technical User
Dec 13, 2001
54
0
0
US
I would like to enter an "x" in a cell with the click of a mouse and delete the "x" with a second click of a mouse. Like an off/on switch. Is there a way I can do that in Excel 2000?

Thank you,
Martha
 
If a DoubleClick is acceptable you can use something like the following :
Code:
Private Sub Worksheet_BeforeDoubleClick( _
        ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Range("A1:F20"), Target) Is Nothing Then
        If Target = "x" Then
            Target = ""
        Else
            Target = "x"
        End If
    End If
End Sub
This code restricts the action to the range A1:F20, which you can change to suit your needs.

To use the code select the sheet you want it to apply to, right click on the sheet tab, select View Code and copy the above code to the window that appears.

A.C.
 
acron,
That is exactly what I needed. Thank you.
Martha
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top