How can I Auto insert an "X" in a cell by just ONE left click????

  • Thread starter Thread starter Mac 5430
  • Start date Start date
M

Mac 5430

How can I Auto insert an "X" in a cell by just ONE left click on the mouse on
that cell?

And once this is set up, some of these 'X' inserts will have a 'Yes" and
"No" cells that "ONLY ONE" can have an "X" in.
 
Add this event code to your worksheet module to get an "X" in any cell you
select in the range A1:A10.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const myRange As String = "A1:A10"
On Error GoTo endit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
Target.Value = "X"
End If
endit:
Application.EnableEvents = True
End Sub

Don't understand the second part about no and yes and only one with an "x"

A "Yes" value is to be turned into an "X" value unless it's a "No" value in
which case it stays the same or something like that?


Gord Dibben MS Excel MVP

On Sun, 13 Apr 2008 11:27:00 -0700, Mac 5430 <Mac
 
I am lost??

Gord Dibben said:
Add this event code to your worksheet module to get an "X" in any cell you
select in the range A1:A10.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const myRange As String = "A1:A10"
On Error GoTo endit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
Target.Value = "X"
End If
endit:
Application.EnableEvents = True
End Sub

Don't understand the second part about no and yes and only one with an "x"

A "Yes" value is to be turned into an "X" value unless it's a "No" value in
which case it stays the same or something like that?


Gord Dibben MS Excel MVP

On Sun, 13 Apr 2008 11:27:00 -0700, Mac 5430 <Mac
 
Right-click on your sheet tab and "View Code".

Copy/paste the code into that module. Edit the "A1:A10" to suit.

Alt + q to return to the Excel window.

When you select any cell(left-click ONE time) in myRange and an "X" will be
inserted.


Gord
 

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

Back
Top