Forum Discussion

Cherry1313's avatar
Cherry1313
Copper Contributor
Jun 18, 2024

Lock some cells for editing at the same time lock another range from pasting

Dear Community, 

 

I have browsed several threads on the platform to find solution to this specific problem but havnt got it anywhere. I know that there is a methodology to lock the cells in a spreadsheet from editing as well as lock in formats to stop users from changing them however how do I do both in one. 

For example, I have a spreadsheet in which there is a table. I would like to lock the columns A,B and C such that users are not able to edit value, at the same time I would like to lock cells in column D,E,F such that users cannot paste in values but access the drop down lists in cells to select values.

 

Is there anyway to achieve this?

 

Your inputs are highly appreciated 🙂 

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    Cherry1313 By default, all cells on a sheet are locked (check this by right-clicking and selecting Cell Properties, locked tab). But the lock is only activated when you protect the worksheet (Review, Protect sheet). It is there where you define what is allowed and what is not allowed.

     

    You cannot disallow pasting using these options. Fortunately, with the latest builds of Excel, protecting a worksheet als protects it against loosing your data validation when the user pastes. But they can still paste invalid values I'm afraid.

    • Cherry1313's avatar
      Cherry1313
      Copper Contributor

      JKPieterse 

      Thank you for the insight. 

      You are right I could not find a way to do it using locking and protecting. 

      VBA provides a work around but unfortunately VBA would need a user to first allow macro runs which in our shared file scenario case cannot be enforced.