View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default activate code on single click

Single click? No. But if you are willing to use a double click (which I
think is more natural and it would avoid accidentally changing a value when
the user clicks into a cell by mistake)...

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If InStr(1, "*Yes*No*", "*" & Target.Value & "*", vbTextCompare) Then
Cancel = True
Target.Value = Mid("YesNo", 1 - 3 * (Len(Target.Value) = 3), 3)
End If
End Sub

You can add code to filter this for specific ranges if that is what you
need.

--
Rick (MVP - Excel)


"sunilpatel" wrote in message
...
Is there a way to activate code on a "Single" click in the activecell /
selected cell on sheet.

i have "no" in cell "a1" and it is selected. i want it to change to "yes"
if i single clik on "a1"

Probably not possible hey?

Sunil