ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msgbox if cell is locked (https://www.excelbanter.com/excel-programming/315455-msgbox-if-cell-locked.html)

scottnshelly[_62_]

msgbox if cell is locked
 

I should know this by now, but can't get it right. how do i display
msgbox if the user tries to click into a locked cell on a protecte
sheet?
thanks

--
scottnshell
-----------------------------------------------------------------------
scottnshelly's Profile: http://www.excelforum.com/member.php...nfo&userid=730
View this thread: http://www.excelforum.com/showthread.php?threadid=27430


Ron de Bruin

msgbox if cell is locked
 
There is also a way that you can't select locked cells but you want a msgbox

Try this in the sheet module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
Dim Ltrue As Boolean
For Each cell In Target
If cell.Locked Then Ltrue = True
Next
If Ltrue = True Then MsgBox "one or more cells in the selection are locked"
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"scottnshelly" wrote in message ...

I should know this by now, but can't get it right. how do i display a
msgbox if the user tries to click into a locked cell on a protected
sheet?
thanks.


--
scottnshelly
------------------------------------------------------------------------
scottnshelly's Profile: http://www.excelforum.com/member.php...fo&userid=7301
View this thread: http://www.excelforum.com/showthread...hreadid=274303





All times are GMT +1. The time now is 03:15 PM.

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