Note: The other languages of the website are Google-translated. Back to English
Inloggen  \/ 
x
or
x
Registreer  \/ 
x

or

Hoe de functies voor knippen, kopiëren en plakken in Excel uit te schakelen?

Stel dat u een werkmap heeft met belangrijke gegevens die u moet beschermen tegen knippen, kopiëren en plakken. Hoe bereik je dit? Dit artikel biedt een VBA-methode waarmee u de functies voor knippen, kopiëren en plakken tegelijkertijd in een Excel-werkmap kunt uitschakelen.

Schakel de functies voor knippen, kopiëren en plakken uit met VBA-code


Schakel de functies voor knippen, kopiëren en plakken uit met VBA-code

Ga als volgt te werk om de functies voor knippen, kopiëren en plakken in een Excel-werkmap uit te schakelen.

1. In de werkmap moet u de functies voor knippen, kopiëren en plakken uitschakelen. Druk op anders + F11 toetsen tegelijkertijd om het Microsoft Visual Basic voor toepassingen venster.

2. In de Microsoft Visual Basic voor toepassingen venster, dubbelklik Dit Werkboek links Project paneel en kopieer en plak vervolgens de onderstaande VBA-code in het ThisWorkbook (code) venster. Zie screenshot:

VBA-code: schakel de functies voor knippen, kopiëren en plakken tegelijkertijd uit in Excel

Private Sub Workbook_Activate()
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub

Private Sub Workbook_Deactivate()
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub

3. Druk dan op de anders + Q toetsen om het Microsoft Visual Basic voor toepassingen venster.

U kunt nu geen gegevens uit deze werkmap knippen of kopiëren, maar gegevens die u uit andere werkbladen of werkmappen hebt gekopieerd, kunnen niet in deze werkmap worden geplakt.

Opmerking:: De functie slepen en neerzetten is ook uitgeschakeld na het uitvoeren van de bovenstaande VBA-code.


Gerelateerde artikelen:


De beste tools voor kantoorproductiviteit

Kutools voor Excel lost de meeste van uw problemen op en verhoogt uw productiviteit met 80%

  • visfuik: Snel invoegen complexe formules, grafieken en alles wat je eerder hebt gebruikt; Versleutel cellen met wachtwoord; Maak een mailinglijst en stuur e-mails ...
  • Super Formula-balk (bewerk eenvoudig meerdere regels tekst en formule); Lay-out lezen (gemakkelijk grote aantallen cellen lezen en bewerken); Plakken in gefilterd bereik...
  • Voeg cellen / rijen / kolommen samen zonder gegevens te verliezen; Gespleten cellen inhoud; Combineer dubbele rijen / kolommen... Voorkom dubbele cellen; Vergelijk Ranges...
  • Selecteer Dupliceren of Uniek Rijen; Selecteer lege rijen (alle cellen zijn leeg); Super zoeken en fuzzy zoeken in veel werkboeken; Willekeurige selectie ...
  • Exacte kopie Meerdere cellen zonder de formuleverwijzing te wijzigen; Maak automatisch verwijzingen naar meerdere bladen; Plaats kogels, Selectievakjes en meer ...
  • Extraheer tekst, Tekst toevoegen, Verwijderen op positie, Ruimte verwijderen; Paging-subtotalen maken en afdrukken; Converteren tussen celinhoud en opmerkingen...
  • Super filter (bewaar en pas filterschema's toe op andere bladen); Geavanceerd sorteren per maand / week / dag, frequentie en meer; Speciaal filter door vet, cursief ...
  • Combineer werkmappen en werkbladen; Tabellen samenvoegen op basis van sleutelkolommen; Gegevens splitsen in meerdere bladen; Batch Converteer xls, xlsx en PDF...
  • Meer dan 300 krachtige functies. Ondersteunt Office / Excel 2007-2019 en 365. Ondersteunt alle talen. Eenvoudig te implementeren in uw onderneming of organisatie. Gratis proefperiode van 30 dagen met volledige functies. 60 dagen geld-terug-garantie.
kte tabblad 201905

Office-tabblad Brengt een interface met tabbladen naar Office en maakt uw werk veel gemakkelijker

  • Schakel bewerken en lezen met tabbladen in Word, Excel, PowerPoint in, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en vermindert elke dag honderden muisklikken voor u!
officetab onderkant
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    j.eri.cely · 1 months ago
    Hi, a question i have a Macro and i feed this file with another file then i need:

    1. Allow Copy  the external file and copy in my macro
    2. Prevent Copy in my macro and paste to external file is posible?
  • To post as a guest, your comment is unpublished.
    Amrit Subedi · 3 months ago
    Hello!
    I am trying to disable cut/paste tool in MS excel 2016 not the copy/paste tool. Can you give an idea?
    Thanks in advance!
  • To post as a guest, your comment is unpublished.
    la.king727@gmail.com · 1 years ago
    Reposting so it is public-apologizing in advance to administrators.

    This works great, how would one modify this to allow copy/paste in specific columns that have pull down menus tied to named ranges of acceptable input and only the acceptable input. For instance a name that is Jetson, George, 25, would allow a copy/paste of Jetson, George, 25 but would not allow Jeston, George, 26. Or a drag and fill that would result in Jetson, George, 25 then 26, then 27, etc.

    In my worksheet I want to completely disable cut/copy/paste in certain columns, then only allow copy/paste of acceptable data from drop downs.

    Thank you.
  • To post as a guest, your comment is unpublished.
    L King · 1 years ago
    This works great, how would one modify this to allow copy/paste in specific columns that have pull down menus tied to named ranges of acceptable input and only the acceptable input. For instance a name that is Jetson, George, 25, would allow a copy/paste of Jetson, George, 25 but would not allow Jeston, George, 26. Or a drag and fill that would result in Jetson, George, 25 then 26, then 27, etc.

    In my worksheet I want to completely disable cut/copy/paste in certain columns, then only allow cut copy paste of acceptable data from drop downs.

    Thank you.
  • To post as a guest, your comment is unpublished.
    Mohamed saber · 1 years ago
    use this code to disable copy cut & paste

    Private Sub Workbook_Activate()
    Application.CutCopyMode = False
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    End Sub

    Private Sub Workbook_Deactivate()
    Application.CellDragAndDrop = True
    Application.OnKey "^c"
    Application.CutCopyMode = False
    End Sub

    Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    Application.CutCopyMode = False
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    End Sub

    Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    Application.CellDragAndDrop = True
    Application.OnKey "^c"
    Application.CutCopyMode = False
    End Sub

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Application.CutCopyMode = False
    End Sub

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    Application.CutCopyMode = False
    End Sub

    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    Application.CutCopyMode = False
    End Sub


    and want to enable these function again
  • To post as a guest, your comment is unpublished.
    Mohamed saber · 1 years ago
    I used this code & want to Re-enable again? how to re-enable it?
  • To post as a guest, your comment is unpublished.
    tabbymulla · 1 years ago
    This still allows pasting from Notepad or Microsoft Edge. Please see if there is a way prevent pasting from any source.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi,
      If prevent pasting from any source, we need to prevent the Notepad feature, which may bring inconvenience. We do not recommend this. Sorry can't help you for that.
  • To post as a guest, your comment is unpublished.
    AMB · 1 years ago
    That code isn't working in my excel 2016 for a single sheet instead of the whole workbook
  • To post as a guest, your comment is unpublished.
    Harish · 1 years ago
    cut copy paste applicable Entire workbook. If i need this Code only i particular sheet.Is it Possible ??
    please help. we need only one sheet disable functions. another sheet we are working all functions...
  • To post as a guest, your comment is unpublished.
    Apolo · 2 years ago
    Thank you, very useful.
  • To post as a guest, your comment is unpublished.
    RAHUL MODI · 2 years ago
    THANKS SIR
  • To post as a guest, your comment is unpublished.
    rasheednoorpk@gmail.com · 2 years ago
    Thanks it works perfect ....can it be applied on a range only somehow?
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Good day,
      Sorry can't help you with that. Welcome to post any question in our forum: https://www.extendoffice.com/forum.html. Thank you for your comment.
  • To post as a guest, your comment is unpublished.
    Sam · 2 years ago
    It really works well, thanks a lot.
  • To post as a guest, your comment is unpublished.
    Vic · 2 years ago
    Hi, the code works well thanks.
    However, the read only option was enabled. (if you don't want to modify). If I set ..File, save as, tools, general options, read only recommended.. then the code does not work.

    Thanks in advance.
  • To post as a guest, your comment is unpublished.
    Al Hammad · 3 years ago
    Thank your for your direction.I am Trying in office 2013 ,but nothing changed.
  • To post as a guest, your comment is unpublished.
    garak0410 · 3 years ago
    Was super glad to find this post but I need a little help in limiting this to a single worksheet in a multi-worksheet Workbook. And need to know how to execute this without user intervention...we need this ASAP on a workbook to help prevent errors.
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Good day,
      The following VBA code can help you to solve the problem. And don't forget to replace "Sheet2" in the code with your sheet name.

      Public mJWSName As String

      Private Sub Workbook_Open()
      mJWSName = "Sheet2"
      End Sub

      Private Sub Workbook_Activate()
      If ActiveSheet.Name = mJWSName Then
      Application.CutCopyMode = False
      Application.OnKey "^c", ""
      Application.CellDragAndDrop = False
      End If
      End Sub

      Private Sub Workbook_Deactivate()
      Application.OnKey "^c", ""
      Application.CellDragAndDrop = True
      Application.CutCopyMode = False
      End Sub


      Private Sub Workbook_WindowActivate(ByVal Wn As Window)
      If ActiveSheet.Name = mJWSName Then
      Application.CutCopyMode = False
      Application.OnKey "^c", ""
      Application.CellDragAndDrop = False
      End If
      End Sub

      Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
      Application.OnKey "^c"
      Application.CellDragAndDrop = True
      Application.CutCopyMode = False
      End Sub

      Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
      On Error Resume Next
      If Sh.Name = mJWSName Then
      Application.CutCopyMode = False
      End If
      End Sub

      Private Sub Workbook_SheetActivate(ByVal Sh As Object)
      On Error Resume Next
      If Sh.Name = mJWSName Then
      Application.OnKey "^c", ""
      Application.CellDragAndDrop = False
      Application.CutCopyMode = False
      End If
      End Sub

      Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
      Application.OnKey "^c"
      Application.CellDragAndDrop = True
      Application.CutCopyMode = False
      End Sub
      • To post as a guest, your comment is unpublished.
        garak0410 · 3 years ago
        One last question - Where does this code go and how does it get executed? The project this needs to work with attaches an XLA file to the Excel sheet that contains much of the code. Didn't know if this needs to go into a module or the code behind this sheet. Thanks...
  • To post as a guest, your comment is unpublished.
    Linda · 3 years ago
    Hi

    I´m a beginner of VBA codes and this code solved 99% of my problems.

    Is it possible to lock the hole sheet (as this code dose) but still have one cell unlocked?
    (Clarify, I would like to allow copy past in info in only one cell in the hole sheet).

    Best regards
    L
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Hello Linda,
      You can solve the problem without using VBA code.
      Right click the cell and select Format Cells from the context menu, uncheck the Locked box under the Protection tab in the dialog. And then protect the worksheet with password.
  • To post as a guest, your comment is unpublished.
    Carmelo · 3 years ago
    Hi,
    Is it possible to disable "CUT" only? but I could still use the Copy and Paste?
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Hi Carmelo,
      Please copy and paste the below code into the Workbook code window in your workbook and then save it as an Excel Macro-enabled workbook. Then the "Cut" function will be disabled.

      Option Explicit
      Private WithEvents Cmbrs As CommandBars

      Private Sub Workbook_Open()
      Set Cmbrs = Application.CommandBars
      End Sub

      Private Sub Workbook_Activate()
      If Application.CutCopyMode = 2 Then
      Application.CutCopyMode = 0
      End If
      End Sub

      Private Sub Cmbrs_OnUpdate()
      If Me Is ActiveWorkbook Then
      If Application.CutCopyMode = 2 Then
      Application.CutCopyMode = 0
      MsgBox "Cut Operations disabled"
      End If
      End If
      End Sub
      • To post as a guest, your comment is unpublished.
        ERCA · 3 years ago
        I tried just like you said but nothing happends. A want exactly the same, Only the
        "Cut" function disabled. I need to disable the "cut" option from Rightclick buton option and from the toolbar.
        It is posible crystal??
        • To post as a guest, your comment is unpublished.
          crystal · 3 years ago
          Good day,
          The code works well in my case. May I know your Office version?
  • To post as a guest, your comment is unpublished.
    midas.solarenergy@gmail.com · 3 years ago
    Dear,

    i want to disable cut, copy, paste in excel 2007 sheet
    can you share code for this
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Good Day,
      Thank you for your comment. I am trying to figure out the solution for Excel 2007. Please wait patiently.
  • To post as a guest, your comment is unpublished.
    Sky · 3 years ago
    How to enable the cut, copy and paste function back? Please advice!
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Dear Sky
      Please run the below VBA1 (place the code in the ThisWorkbook module) to disable the cut, copy and paste function in your workbook.

      VBA1:
      Sub DelCopy()
      With Application
      .OnKey "^x", ""
      .OnKey "^c", ""
      .CommandBars("Cell").Controls(1).Enabled = False
      .CommandBars("Cell").Controls(2).Enabled = False
      End With
      End Sub

      And the run the VBA2 to enable all these functions back to your workbook.

      VBA2:
      Sub RecoverCopy()
      With Application
      .OnKey "^x"
      .OnKey "^c"
      .CommandBars("Cell").Controls(1).Enabled = True
      .CommandBars("Cell").Controls(2).Enabled = True
      End With
      End Sub
      • To post as a guest, your comment is unpublished.
        mags · 3 years ago
        This doesn't seem to have worked for me - should I delete the original VBA code and then paste the above in to enable the Cut, copy and paste function again?
        • To post as a guest, your comment is unpublished.
          crystal · 3 years ago
          Good Day,
          The VBA1in above comment is the replacement of the original code.
  • To post as a guest, your comment is unpublished.
    martinkunder1988@gmail.com · 4 years ago
    Thanks a Lot.Its working in entire worbook. Can we do the coding only for 1 sheet.Please help .
  • To post as a guest, your comment is unpublished.
    Martin · 4 years ago
    Thanks u Sir its working .But in Entire workbook. If i need this Code only i particular sheet.Is it Possible ??
    • To post as a guest, your comment is unpublished.
      sa · 3 years ago
      have you found an answer?
  • To post as a guest, your comment is unpublished.
    rafhtaher · 4 years ago
    i do as above but the function of cut copy and past disabled in any excel file i open .why?
    • To post as a guest, your comment is unpublished.
      Stuart Davis · 2 years ago
      Hi, I used this to hide "Cut" from users and it works great unless you have a Table, the "Cut" miraculously re-appears when you select a cell in the Table, exactly what i'm trying to avoid. any ideas? thanks!