• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unlock Cell Based on a Character in Another Cell

dparteka

Member
I have this code that works great but I'm looking to tweak it a bit by changing SubRng.EntireRow.Locked = False which unlocks the entire row to having it unlock only the single cell in that row in column F... thanks for looking and I appreciate the help.
Code:
Dim Rng As Range
Dim SubRng As Range

Set Rng = Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each SubRng In Rng

  If SubRng = "?" Then
   SubRng.EntireRow.Locked = False
  End If

Next SubRng
 
Code:
Dim Rng As Range
Dim SubRng As Range

Set Rng = Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each SubRng In Rng

    If SubRng = "?" Then
        Range("F" & SubRng.Row).Locked = False
    End If

Next SubRng
 
Well chirayu, thank you again. Did you recognize that code, it was a portion of yours from a previous post. This one works just as good as the last one... very appreciative of your help.
 
Yeah recognized it. Just wondered why you asked the question because in previous thread I showed how to save the row & use it :p but this time I didn't save the row as variable. I just did "SubRng.Row"
 
This is a different scenario… the cell in column-F is blank and locked to prevent premature entry prior to all other cells in the row being filled or in other words, column-F cell is the last entry in the row.

So, what happens is your code above unlocks all cells in column-F that have the “!” in column-A. The user then makes the entry in any column-F cell that is unlocked and then your original code from the previous post is run resulting in a complete lock out of those rows... hope that make sense, it works great.
 
Back
Top