Consulting

Results 1 to 4 of 4

Thread: Allow Auto Data Entry into a locked cell.

  1. #1

    Allow Auto Data Entry into a locked cell.

    Hello there

    i have a column which when either “decide” / “undecided” is selected from a drop down menu it auto populates another column next to it with a date.

    The problem is when I lock the cell as I don’t want anyone to put data in themselves, the locked cell does not allow the auto data that I have requested.

    Hiw is can I get round this.

    ta

  2. #2
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location
    Quote Originally Posted by Silverfox123 View Post
    . . . it auto populates another column next to it with a date.
    How is this "auto populate" being done ?

  3. #3
    On my workbook Column K auto populates with the date and time if column N has any data selected in it, selected by the user. I don't want users to be able to put any data in themselves, however if I lock the cell it wont auto populate? Can the cell be locked but still allow auto data?


    The code I have is:

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim xCellColumn As Integer
    Dim xTimeColumn As Integer
    Dim xRow, xCol As Integer
    Dim xDPRg, xRg As Range
    xCellColumn = 14
    xTimeColumn = 11
    xRow = Target.Row
    xCol = Target.Column
    If Target.Text <> "" Then
    If xCol = xCellColumn Then
    Cells(xRow, xTimeColumn) = Now()
    Else
    On Error Resume Next
    Set xDPRg = Target.Dependents
    For Each xRg In xDPRg
    If xRg.Column = xCellColumn Then
    Cells(xRg.Row, xTimeColumn) = Now()
    End If
    Next
    End If
    End If
    End Sub
    Last edited by Paul_Hossler; 01-17-2019 at 10:20 AM. Reason: Removed italics and added {CODE] tags

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    A quick and dirty solution might be
    Me.Protect userinterfaceonly:=True
    as the first line of the sub.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •