![]() |
|
#1
|
|||
|
|||
|
can you help for the next? "If cell contains string restrict record" to read only.
Thanx If B1 contains "yes" make A1, B1 , C1 record read only |
|
#2
|
||||
|
||||
|
Is this to be run automatically, so that the cell gets protected/unprotected automatically (when changes occur or, for example when the workbook is opened/saved/closed), or as a macro someone has to run?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
When changes occur,automatically protected . Thx
|
|
#4
|
||||
|
||||
|
What happens if someone subsequently changes B1 to something other than 'yes'? Should the other cells remain protected; or should they be unprotected?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
The other cells should be unprotected. Only by "yes" protected.
|
|
#6
|
||||
|
||||
|
You could add the following code to the relevant worksheet's code module:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Const StrPwd As String = ""
With ActiveSheet
If Intersect(Target, .Range("A1:C1")) Is Nothing Then Exit Sub
If .ProtectContents = True Then Exit Sub
If UCase(.Range("B1").Value) = "YES" Then
.Cells.Locked = False
.Range("A1:C1").Locked = True
.Protect Password:=StrPwd, Contents:=True
End If
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Message "Unable to read file" when clicking on the Excel icon | roundman | Excel | 3 | 12-03-2014 04:28 PM |
| Is it possible to make Word link to the last record in Excel | stephen_pen | Word | 0 | 09-22-2011 11:00 PM |
Mailing: how to make the "page number" in Word is the same as "row number" in excel w
|
Jamal NUMAN | Word | 1 | 09-03-2011 11:37 AM |
| Monitoring "Record Narration"? | knewman | PowerPoint | 1 | 04-23-2011 04:59 PM |