Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnClick [email protected] Excel Discussion (Misc queries) 1 August 31st 06 06:08 PM
Command Button OnClick Ken McLennan[_3_] Excel Programming 2 September 29th 04 12:57 PM
onclick event for cell ties Excel Programming 4 July 20th 04 12:09 PM
onClick action from cell selection Beanymonster Excel Programming 4 July 16th 04 09:25 PM
range onclick? Dennis Excel Programming 2 November 23rd 03 07:34 PM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"