on mousedown event for a cell?

  • Thread starter Jonathon Baddock
  • Start date
J

Jonathon Baddock

One of our engineers has this fairly long spreadsheet. He as a cell for
yes and no, and if it's suppose to be yes, he puts a red X in the yes
Box. There is a cell that has a formula so if this cell equals X, it
displays a certain formula.

We were trying to get away from having to manually put an X in the box,
want to be able to just click with the mouse and it is inserted
automatically, or if clicked again, goes away.
Does anyone have any ideas, I've been toying around, but to no success
at the moment.

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
F

Frank Kabel

Hi
one way: put the following code in your worksheet module:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("D:D")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Value = ""
Else
.Value = "X"
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub
 

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

Top