Optimize Time In Filling Cells

  • Thread starter Thread starter rfs04
  • Start date Start date
R

rfs04

Hello all,

Does anybody know if it's possible to make excel putting a cross or a
circle or whatever in a cell only by clicking on it and if you click
again it disappears??

Maybe its science fiction?

Thanks in advance.
 
right click on sheet tab>view code>insert this>save>double click on cell.
You probably want to restrict cells.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target = "" Then
Target.Value = 0
ElseIf Target = 0 Then
Target.Value = ""
End If
End Sub
 
rfs04 said:
Hello all,

Does anybody know if it's possible to make excel putting a cross or a
circle or whatever in a cell only by clicking on it and if you click
again it disappears??

Maybe its science fiction?

If you'd settle for a right-click you could try something like:
'''
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Select Case Target.Formula
Case "": Target.Formula = "X"
Case "X": Target.Formula = "O"
Case Else: Target.Formula = ""
End Select
Cancel = True
End Sub
'''
Though you might want to check the range you are in.

For instance add:

If Target.Row > 3 Or Target.Column > 3 Then Exit Sub

before the Select Case if you're playing noughts & crosses (tic-tac-toe)
 
Back
Top