+ Reply to Thread
Results 1 to 4 of 4

Can you lock designated cells

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    37

    Can you lock designated cells

    Can you lock certain cells so the reps using the Excel can't change? Basically they are continually overriding the formulas in place cause errors, can I lock the cells that have formulas?

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: Can you lock designated cells

    .
    When you lock a cell or individual cells you also have to protect the entire worksheet for it to take effect. That makes the entire sheet inaccessible.


    Here is a workaround however. It "watches" a set range and if the user attempts to enter anything into those cells, the cursor is directed to a different
    area of the sheet. A message box warning can be added to advise the user their actions are unwarranted.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Can you lock designated cells

    Thanks for this, is this VBA code? Reason I ask is I already have a code in place for a different reason am I able to apply two different codes in the same worksheet? I'm no pro with coding, if you can do two how would I achieve that? This is the current code allowing to have multiple selections in a drop down, how do I add to it?

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Updated by AprilBenjamin-Martins 2019/11/13
    Dim xRng As Range
    Dim xValue1 As String
    Dim xValue2 As String
    If Target.Count > 1 Then Exit Sub
    On Error Resume Next
    Set xRng = Cells.SpecialCells(xlCellTypeAllValidation)
    If xRng Is Nothing Then Exit Sub
    Application.EnableEvents = False
    If Not Application.Intersect(Target, xRng) Is Nothing Then
    xValue2 = Target.Value
    Application.Undo
    xValue1 = Target.Value
    Target.Value = xValue2
    If xValue1 <> "" Then
    If xValue2 <> "" Then
    If xValue1 = xValue2 Or _
    InStr(1, xValue1, ", " & xValue2) Or _
    InStr(1, xValue1, xValue2 & ",") Then
    Target.Value = xValue1
    Else
    Target.Value = xValue1 & ", " & xValue2
    End If
    End If
    End If
    End If
    Application.EnableEvents = True
    End Sub

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: Can you lock designated cells

    .
    Yes you can.

    Your macro is using the Worksheet_Change event.
    My macro is using the Worksheet_SelectionChange.

    Two different animals.

    Give it a try and see what happens. If you have any concerns, make a copy of your workbook and try it there first.

+ 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. shell to search for a designated term in a designated folder
    By drech in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2016, 01:33 PM
  2. Count designated cells
    By Biff in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 PM
  3. [SOLVED] Count designated cells
    By VB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  4. [SOLVED] Count designated cells
    By VB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  5. [SOLVED] Count designated cells
    By Biff in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 07:05 AM
  6. Count designated cells
    By Biff in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  7. Count designated cells
    By VB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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