+ Reply to Thread
Results 1 to 5 of 5

Depending on input, lock or activate cells.

Hybrid View

jacktiser Depending on input, lock or... 03-28-2012, 03:28 AM
arlu1201 Re: Depending on input, lock... 03-28-2012, 03:30 AM
jacktiser Re: Depending on input, lock... 03-28-2012, 04:58 AM
arlu1201 Re: Depending on input, lock... 03-28-2012, 06:01 AM
Irish RayRay Re: Depending on input, lock... 03-28-2012, 07:48 AM
  1. #1
    Registered User
    Join Date
    03-22-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Depending on input, lock or activate cells.

    Say, I have cells A1:A5 to work with.

    - If I input the letter "A" in B1, then A1:A5 should all be blank and allow for value/formula input with normal editing.
    - If I input the text "NA" in B1, then A1:A5 should all be filled with "NA" and automatically be locked for editing

    What would the formula be?

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Depending on input, lock or activate cells.

    I dont think you can do the locking by formula, you will need a macro for this.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    03-22-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Depending on input, lock or activate cells.

    What would the formula be if I remove the requirement to have the cells automatocally locked?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Depending on input, lock or activate cells.

    Copy this formula in A1. Drag till A5.

    =IF($B$1="A","",IF($B$1="NA","NA"))

  5. #5
    Registered User
    Join Date
    03-14-2012
    Location
    Galway, Ireland
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Depending on input, lock or activate cells.

    You could use code like this.
    If you wanna lock a cell the sheet has to be proctected first.


    This Code goes into (Press ALT + F11 then Ctrl + R then select ThisWorkBook and Paste it in there)
    if you want you could have a if statment to check your on the right sheet first.
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
        If Range("B1").Formula = "A" Then
            Range("A1:A5").Formula = "A"
        End If
        If Range("B1").Formula = "NA" Then
            Range("A1:A5").Formula = "NA"
        End If
    End Sub

+ Reply to Thread

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