Forum Discussion

dhirajashet24's avatar
dhirajashet24
Copper Contributor
Mar 21, 2023

Disable copy paste function without VBA code

Hello, need some guidance in Excel. We have standard Excel format in office and customer need to update the data in the same format however they overwrite the drop down list by copy pasting the data either from same excel or from another excel sheet. How to protect or stop copy paste on drop down column but select from drop-down option enable and save the file. I tried using protect sheet function but then drop-down function cannot be selected and save. Also VBA coding is not allowed.

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    dhirajashet24 

    How to protect or stop copy paste on drop down column but select from drop-down option enable and save the file, without VBA?

     

    The following steps may help.

    1. Select all cells with drop down list in the worksheet you need to protect. Click Find & Select > Data Validation under Home tab.
    2. Right click on them and select Format Cells in the right-clicking menu. In the Format Cells popup, go to Protection tab and uncheck Locked box. Click OK.
    3. Go to Review tab and click Protect Sheet button. In the Protect Sheet popup, check Protect worksheet and contents of locked cells option and enter a password if needed. Click OK.

    This way, you can protect your worksheet from copying or pasting but still allow users to select from drop-down options.

    Hope I could help you with these information.

     

    NikolinoDE

    I know I don't know anything (Socrates)

      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor

        Amila_Rambukwella 

        So far I know…Excel doesn’t offer a native, non-VBA solution to fully disable copy-paste functionality or restrict drag-and-drop operations in specific cells while keeping drop-down lists intact.

        That’s why I give some few alternative approaches, they don't completely solve the problem, but they could help. If not, please ignore these approaches.

    • Marthurvin's avatar
      Marthurvin
      Copper Contributor

      NikolinoDE 

       

      Ok here's my situation. I have an absurdly complex (by our standard, at any rate) budget that I designed for my department to use for federal grants. It involves formulas that are longer than the width of my screen and over a thousand lines of VBA. The intent is that anyone that understands how federal grants work can use it to enter in the appropriate information without having to be great at math or know (most of) the different exceptions. Somehow, someway, my boss (who is very intelligent but a bit more boomer than I am) kept breaking the budget. 

      IT WAS DRIVING ME CRAZY. Formulas would randomly stop working. Formatting would be changed despite me having a listener that relocks the spreadsheet every time something changes. I spent MONTHS trying to figure out what she was doing, then a day or two ago I finally saw it in action. She was copy/pasting by right-clicking instead of using ctrl+v (boomer) and picking one of the clipboard icons (w/o formatting, I think?). It FOR SOME REASON allows you to bypass restrictions on editing locked cells if you are cut/pasting or copy/pasting in this manner.

      This is a HUGE problem for me because there are <does some quick math> Literally 200+ formulas of references that she could accidentally break by copy/pasting in this way, and it is not always obvious to her that they are broken (tbf, it wouldn't be obvious to 99.999% of people b/c the errors induced can be so small relative to the amount of the grant). Do you know of any way to prevent copy/pasting? It is bypassing formula protection and giving me no end of fits. I'm literally to the point of - and I am not joking - replacing all formulas with VBA that she can't mess with. I'm hoping someone on the interwebs (you?) has a better idea b/c that would be really, really time-consuming and inefficient. It's mind-boggling to me that the built in "protect" bit doesn't work.

       

      Again, you can't click something you aren't supposed to click on, but you can alter formatting and cause reference problems by (for example) copying from a cell that is merged into another merged cell of the same size which (for some reason?) is causing the cell receiving the new values to split into two cells again. 

      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor

        Marthurvin 

        To address the problem of users inadvertently breaking formulas and formatting in a protected Excel workbook without using VBA, there are a few approaches you can take. Although completely disabling copy-paste isn't possible without VBA, you can mitigate the issue by using data validation, worksheet protection settings, and designing the sheet in a way that reduces the likelihood of errors.

        Approach 1: Using Data Validation and Worksheet Protection

        1. Unlock Cells for Data Entry:
          • Select all the cells where you want users to enter data.
          • Right-click and select Format Cells.
          • Go to the Protection tab and uncheck Locked.
          • Click OK.
        2. Apply Data Validation:
          • Select the cells with drop-down lists or data entry.
          • Go to Data tab -> Data Validation.
          • Set up your data validation criteria.
        3. Protect the Worksheet:
          • Go to the Review tab.
          • Click on Protect Sheet.
          • Ensure Protect worksheet and contents of locked cells is checked.
          • Ensure Select unlocked cells is checked.
          • Enter a password if required and click OK.

        Approach 2: Use Conditional Formatting to Highlight Issues

        1. Highlight Cells with Potential Errors:
          • Use conditional formatting to highlight cells where formulas or formatting have been altered.
          • Go to Home tab -> Conditional Formatting.
          • Create a rule to highlight cells that deviate from expected formats or values.

        Approach 3: Design the Sheet to Minimize Errors

        1. Use Separate Sheets for Data Entry and Calculations:
          • Separate the data entry areas from the calculation areas.
          • Use references to link the data entry sheet to the calculation sheet.
          • Protect the calculation sheet entirely, allowing no changes.
        2. Provide Clear Instructions:
          • Add comments or notes to guide users on how to correctly enter data without breaking the structure.
          • Use color coding or shading to differentiate between editable cells and protected cells.
        3. Restrict Formatting Changes:
          • Ensure that in the Protect Sheet dialog, options like Format cells, Format columns, and Format rows are unchecked to prevent users from making formatting changes.

        Approach 4: Monitoring and Error Checking

        1. Use Built-in Excel Features for Error Checking:
          • Enable Excel’s built-in error checking features to catch common errors.
          • Go to File -> Options -> Formulas.
          • Ensure Enable background error checking is checked.
        2. Use Helper Columns for Validation:
          • Create hidden helper columns that validate data entry and highlight discrepancies.
          • Use functions like IF, ISERROR, or COUNTIF to create checks.

        Example Implementation

        Unlock and Protect Cells:

        // Select cells A1:A10 (example for data entry)

        1. Right-click -> Format Cells -> Protection -> Uncheck Locked
        2. Data -> Data Validation -> Set criteria
        3. Review -> Protect Sheet -> Check "Protect worksheet and contents of locked cells" and "Select unlocked cells"

        Conditional Formatting for Errors:

        // Highlight cells with invalid data

        1. Select range
        2. Home -> Conditional Formatting -> New Rule
        3. Use a formula to determine which cells to format: =ISERROR(A1) (example)
        4. Set desired formatting

        Separate Data Entry and Calculation Sheets:

        // Example of linking sheets

        1. Data Entry in Sheet1
        2. Calculations in Sheet2
        3. In Sheet2, reference Sheet1: =Sheet1!A1
        4. Protect Sheet2 completely

        By following these approaches, you can significantly reduce the risk of users breaking your formulas and formatting, even without disabling copy-paste functionality directly. These methods provide a robust way to manage user input and maintain the integrity of your workbook. The text and steps were edited with the help of AI.

         

        My answers are voluntary and without guarantee!

         

        Hope this will help you.

Resources