+ Reply to Thread
Results 1 to 3 of 3

Lock/protect cells after value entered

Hybrid View

  1. #1
    Registered User
    Join Date
    10-12-2016
    Location
    Australia
    MS-Off Ver
    Office Professional Plus 2013
    Posts
    2

    Lock/protect cells after value entered

    Hi all,

    First time poster, (not) long time excel user.

    I need some help protecting cell ranges from being updated.

    I have a spreadsheet used to prepare, approve and upload data. At each step (prepare, approve and upload) i have a range of cells that each have a formula to record the username, hostname and date/time. The trouble is the username, hostname and date/time all update/refresh the next time the file is opened.

    Is there a way to lock/protect the cells that contain the username, hostname and date/time after the values have been entered by the preparer, approver and uploader?

    I've attached the spreadsheet as an example.

    Kind Regards,
    Will.
    Attached Files Attached Files

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,499

    Re: Lock/protect cells after value entered

    Put below code in the Sheet Module of the sheet your working in.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("C3,C7,C11")) Is Nothing Then
            With Target
                .Offset(, 2) = Environ$("Username")
                .Offset(1, 2) = Environ$("computername")
                .Offset(2, 2) = Now()
            End With
        End If
    End Sub
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    10-12-2016
    Location
    Australia
    MS-Off Ver
    Office Professional Plus 2013
    Posts
    2

    Re: Lock/protect cells after value entered

    Thank you. Let me try and come back with the results.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Lock Range of Cells After Text is Entered
    By cshenold in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2012, 01:21 PM
  2. lock and protect all but certain cells
    By JediMaster in forum Excel General
    Replies: 5
    Last Post: 08-20-2010, 09:52 AM
  3. pROTECT OR lOCK CELLS SO THAT THEY CANNOT BE EDITED
    By facmess1 in forum Excel General
    Replies: 1
    Last Post: 05-31-2007, 05:26 PM
  4. Lock/Protect cells so they cant get overwritten
    By Mayhs in forum Excel General
    Replies: 3
    Last Post: 04-11-2007, 02:16 PM
  5. Can I protect/lock only the cells containing formulas?
    By JLee98 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2007, 10:17 PM
  6. Protect/Lock Specific Cells
    By srf1030 in forum Excel General
    Replies: 6
    Last Post: 07-06-2005, 04:05 PM
  7. [SOLVED] Can I use the grouping and lock and protect cells
    By bfisher in forum Excel General
    Replies: 1
    Last Post: 01-11-2005, 07:06 PM

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