Results 1 to 18 of 18

lock adjacent cell conditional on cell value

Threaded View

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    Rockville, MD
    MS-Off Ver
    Excel 2003
    Posts
    47

    lock adjacent cell conditional on cell value

    I have a spreadsheet I am developing that has 100 columns (320 rows in each column (row 3 through 323) of drop down lists with 2 values each, "Data", and "No Data" are the values. Each column If the user selects "No Data" for any of those cells, I want the adjacent cell to be locked. I have some code that works for an individual cell; but I need a universal macro that will work for any of the 100 x 323 cells. Plus the code I am using seems to take a really long time for what it does. The code I have is

    Private Sub worksheet_change(ByVal Target As Excel.Range)
        ' Locks range if condition is met
          
        If Range("E3").Value = "No Data" Then
           ActiveSheet.Unprotect
           Range("F3").Select
            Selection.Locked = True
            Selection.Value = ".N"
            ActiveSheet.Protect
     
        Else
            ActiveSheet.Unprotect
            Range("F3").Select
            Selection.Locked = False
            Selection.Value = ""
            ActiveSheet.Protect
        
        End If
               
    End Sub
    Last edited by ShoshanaM; 09-28-2012 at 03:57 PM. Reason: corrected mistake

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