ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I automatically put X in a cell just by clicking that cell? (https://www.excelbanter.com/excel-discussion-misc-queries/47796-can-i-automatically-put-x-cell-just-clicking-cell.html)

jjakel

Can I automatically put X in a cell just by clicking that cell?
 
In Excel, I want to have a spreadsheet where users can check-mark cells, just
by clicking that cell...not actually having to type an X in it. Is this
possible and if so, how?

Paul B

jjakel, you can with some code, put in worksheet code, right click on the
worksheet tab a view code, paste this in, will put an X in column A when you
click in it, will also remove it if you click it again

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 1 Then
If Len(Trim(Target.Value)) = 0 Then
Target.Value = "X"
Else
Target.ClearContents
End If
End If
End Sub

You could also make it put in a check mark like this

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 1 Then
If Len(Trim(Target.Value)) = 0 Then
Target.Value = Chr(252)
Target.Font.Name = "Wingdings"
Target.Font.Size = 10
Else
Target.ClearContents
End If
End If
End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"jjakel" wrote in message
...
In Excel, I want to have a spreadsheet where users can check-mark cells,
just
by clicking that cell...not actually having to type an X in it. Is this
possible and if so, how?




PCLIVE

Why not use checkboxes from the Control Toolbox toolbar. Then link the
check box to a cell.
Just a thought.

Paul

"jjakel" wrote in message
...
In Excel, I want to have a spreadsheet where users can check-mark cells,
just
by clicking that cell...not actually having to type an X in it. Is this
possible and if so, how?





All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com