Results 1 to 2 of 2

Lock and clear cell content based on another cell's value

Threaded View

  1. #1
    Registered User
    Join Date
    12-20-2007
    Posts
    10

    Lock and clear cell content based on another cell's value

    Hi,

    I have this code from http://www.mrexcel.com/archive/VBA/19248.html
    This does all the things I required, except clear the contents of the cell B7 when "BPS" is selected in B6.
    Following is the code I am using:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ActiveCell.Address <> Target.Address Then Exit Sub
    If Target.Address = "$B$7" Then
    If [B6] = "BPS" Then
    ActiveSheet.Unprotect ("PASSWORD")
    [B7].Locked = False
    [B7].ClearContents
    ActiveSheet.Protect ("PASSWORD")
    MsgBox "Sorry, this is for ITS only" & vbCrLf & _
    "", 64, "Access into cell B7 not allowed."
    
    End If
    End If
    End Sub
    Pls help me ensuring that cell value in B7 is cleared whenever B6 contains BPS...thanks
    Last edited by mohitmahajanin; 10-23-2008 at 07:24 AM.

Thread Information

Users Browsing this Thread

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

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