locked
Locking Partial Rows RRS feed

  • Question

  • I'm using the following to lock a row after entering data in that row by typing lock in a column.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
    If Not Target = "Lock" Then Exit Sub
    ActiveSheet.Unprotect Password:="XXX"
    Target.Rows.EntireRow.Locked = True
    ActiveSheet.Protect Password:="XXX"
    ActiveSheet.EnableSelection = x1UnlockedCells

    End Sub

    Each row is basically a sign out of equipment with name of person, type of equipment, date its borrowed and estimated return date.  I type Lock in a specific column in this case column F and it locks the entire row.  Works great except I want column G to be the date the item is returned.  How do I specify the range of my rows to lock then have the cell with the return date lock once I hit Enter?


    Friday, June 5, 2020 2:48 AM

All replies

  • Hi Phoenix91408,

    This forum focuses more on general questions related to Office desktop applications, considering the issue is mainly related to VBA code, I'd like to suggest you post a new question to the following forum: Excel for Developers. You may get more replies there.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emily


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Friday, June 5, 2020 9:45 AM