Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-26-2017, 03:36 PM
Logit Logit is offline How can I automatically protect only certain cells in Excel 2010 Windows 10 How can I automatically protect only certain cells in Excel 2010 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Paste this into the Sheet Level module for the worksheet.


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim MyRange As Range

    Set MyRange = Intersect(Range("A1:D100"), Target)  '<-- change range of rows here
    If Not MyRange Is Nothing Then
        Sheets("Sheet1").Unprotect password:="hello"  '<-- this is your password, change as required.
        MyRange.Locked = True
        Sheets("Sheet1").Protect password:="hello"
    End If
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How Do You Drag & Drop Cells in Excel 2010? juliansdad Excel 4 12-05-2013 01:15 AM
Linking cells on Excel 2010 teza2k06 Excel 1 02-05-2013 01:03 AM
How can I automatically protect only certain cells in Excel 2010 Excel VBA: Worksheet_Change Cells.Protect tinfanide Excel Programming 8 04-08-2012 09:58 PM
Protect / Lock Cells / Print Set-up? meggenm Excel 3 01-26-2012 09:57 PM
Automatically entering/fill data in cells in Excel 2003 dipdog Excel 0 08-17-2006 08:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:49 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