![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Hi, I want to only Protect Cell Formulas without Protecting Entire Worksheet.
Thats you can do by format menu, lock and unlock,etc and set a password. I want to put custom input box there. for example, I already protect the cell, but if somebody tries to enter value in there, then I want to show input box to unprotect the cell. instead of going to tools, Unprotection, etc. Is there any way how to do that. I shall be thankful. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
I assume this is just a followup to your previous question. Why did you abandon your old thread? Anyway, try the following code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim ColNum As String, RowStart As String, RowEnd As String Dim SelCol As String, SelRow As String ColNum = "$B$" RowStart = "15" RowEnd = "25" SelCol = Left(Target.Address, 3) SelRow = Right(Target.Address, 2) If SelCol = ColNum And Application.WorksheetFunction.And( _ SelRow >= RowStart, SelRow <= RowEnd) Then pwrd = InputBox("Enter Password") GoTo 1 End If Exit Sub 1 If pwrd = "password" Then ActiveSheet.Unprotect "password" Target.Locked = False ActiveSheet.Protect "password" Else: MsgBox "Wrong password" End If End Sub
__________________
Kind regards, Al Chara |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|