View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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