Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 11-08-2016, 04:42 AM
macropod's Avatar
macropod macropod is offline Ifcontains "yes" make A1, B1 , C1 record read only Windows 7 64bit Ifcontains "yes" make A1, B1 , C1 record read only Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
As coded, no password is used. To use a password, simply type it between the "" characters in 'Const StrPwd As String = ""'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Thread Tools
Display Modes


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
Ifcontains "yes" make A1, B1 , C1 record read only 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft