Results 1 to 4 of 4

lock cells after data entry

Threaded View

  1. #1
    Registered User
    Join Date
    03-02-2011
    Location
    India
    MS-Off Ver
    Excel 2003/2010
    Posts
    38

    lock cells after data entry

    Hi,

    The below code works for column A and B. When I enter data in any row in column A (lets say A1), the adjacent row in column B i.e., B1 will take a times stamp and then every row having data in it (i.e., A1 and B1 in this example) will get locked.

    What I am looking for is the code which do the same thing but for column C and column D also.

    Below is the code which i m using in Worksheet module :

    
    Option Explicit 
     
    Private Sub Worksheet_SelectionChange(ByVal Target As Range) 
        If Target.Column > 2 Then Exit Sub 'only works in Columns A & B
        With ActiveSheet 
            .Unprotect 
            If Target.Value > "" Then Target.Locked = True 
            .Protect 
        End With 
    End Sub
    Can someone help?

    Thanks in advance.

    Aleen
    Last edited by aleenkhan; 08-06-2012 at 01:25 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1