• 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.

lock cells in one column based on blanks in another

Rodger

Member
I know this must be easy, but i've been trying.

I'd like Column K (7:107) to unlock if F in the same row has data
and lock if F (7:107) does not.

Code:
Sub gotoInventory()

   
    Dim rCell As Range
    Dim rRng As Range

    Set rRng = Sheets("inventory").Range("K7:K107")

    For Each rCell In rRng.Cells

        If Target.Offset(-5, 0).Value = "" Then ActiveCell.Locked = True
    Next rCell
 
Hey Narayan, (man your fast)
It still yellow flags me on
If Target.Offset(-5, 0).Value = ""Then
i must be missing simple punctuation?
 
Hi ,

Try this :
Code:
Sub gotoInventory()
    Dim rCell As Range, rRng As Range

    Set rRng = Sheets("inventory").Range("K7:K107")

    rRng.Cells.Locked = False
   
    For Each rCell In rRng.Cells
        If rCell.Offset(, -5).Value = "" Then rCell.Locked = True
    Next rCell
End Sub
Narayan
 
I'm not sure why you take the time, but thanks again.
I'm just a home programmer taking care of community crafters, people who knit and draw and grow things. Thanks for helping me make it easier for them to do the books. You gave me advice a couple times now.
I hope you know that it is Greatly appreciated. One little code you help me with makes a lot of older peoples computer entering a lot easier.
Just wanted you to know
cheers Narayan
 
Back
Top