Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
onClick in Excel
Is it possible to have a cell automatically display an "X" when a user clicks
on it e.g. using the onClick in VBA? The user does not want to use the "tick box" under the forms toolbar. He would like an "X" in a cell when he clicks on it or even double click. The worksheet will also be protected at the end so that only certain cells can be added. Is this possible? If yes, how would I go about it? Any ideas? Regards Nicole |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
onClick in Excel
Right-click the Sheet Tab and select View Code
Paste this code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Target.Value = "X" Cancel = True End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "Nicole" wrote in message ... Is it possible to have a cell automatically display an "X" when a user clicks on it e.g. using the onClick in VBA? The user does not want to use the "tick box" under the forms toolbar. He would like an "X" in a cell when he clicks on it or even double click. The worksheet will also be protected at the end so that only certain cells can be added. Is this possible? If yes, how would I go about it? Any ideas? Regards Nicole |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
onClick in Excel
Nicole,
Here is some code to do it. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Cells.Count = 1 Then If Me.ProtectContents And Target.Locked Then Else Target.Value = "X" End If End If End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. Top protect some cells - first select all cells on the worksheet - goto FormatCells and on the protection tab, uncheck Locked and exit - select the cells you want to protect - goto FormatCells and on the protection tab, check Locked and exit - goto ToolsProtectionProtect Worksheet (set a password if you wish) and OK -- HTH RP (remove nothere from the email address if mailing direct) "Nicole" wrote in message ... Is it possible to have a cell automatically display an "X" when a user clicks on it e.g. using the onClick in VBA? The user does not want to use the "tick box" under the forms toolbar. He would like an "X" in a cell when he clicks on it or even double click. The worksheet will also be protected at the end so that only certain cells can be added. Is this possible? If yes, how would I go about it? Any ideas? Regards Nicole |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
onClick in Excel
Cool...many thanks to both of you :)
"Nicole" wrote: Is it possible to have a cell automatically display an "X" when a user clicks on it e.g. using the onClick in VBA? The user does not want to use the "tick box" under the forms toolbar. He would like an "X" in a cell when he clicks on it or even double click. The worksheet will also be protected at the end so that only certain cells can be added. Is this possible? If yes, how would I go about it? Any ideas? Regards Nicole |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
OnClick | Excel Discussion (Misc queries) | |||
Command Button OnClick | Excel Programming | |||
onclick event for cell | Excel Programming | |||
onClick action from cell selection | Excel Programming | |||
range onclick? | Excel Programming |