Ga naar hoofdinhoud

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.

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


Gerelateerde artikelen:

Beste Office-productiviteitstools

🤖 Kutools AI-assistent: Een revolutie teweegbrengen in de data-analyse op basis van: Intelligente uitvoering   |  Genereer code  |  Aangepaste formules maken  |  Analyseer gegevens en genereer grafieken  |  Roep Kutools-functies aan...
Populaire functies: Zoek, markeer of identificeer duplicaten   |  Verwijder lege rijen   |  Combineer kolommen of cellen zonder gegevens te verliezen   |   Ronde zonder formule ...
Super opzoeken: Meerdere criteria VLookup    VLookup met meerdere waarden  |   VOpzoeken over meerdere bladen   |   Fuzzy opzoeken ....
Geavanceerde vervolgkeuzelijst: Maak snel een vervolgkeuzelijst   |  Afhankelijke vervolgkeuzelijst   |  Multi-select vervolgkeuzelijst ....
Kolom Beheerder: Voeg een specifiek aantal kolommen toe  |  Kolommen verplaatsen  |  Schakel de zichtbaarheidsstatus van verborgen kolommen in  |  Vergelijk bereiken en kolommen ...
Uitgelichte functies: Raster focus   |  Ontwerpweergave   |   Grote formulebalk    Werkmap- en bladbeheer   |  resource Library (Auto-tekst)   |  Datumkiezer   |  Combineer werkbladen   |  Cellen coderen/decoderen    Stuur e-mails per lijst   |  Super filter   |   Speciaal filter (filter vet/cursief/doorhalen...) ...
Top 15 gereedschapsets12 Tekst Tools (toe te voegen tekst, Tekens verwijderen, ...)   |   50+ tabel Types (Gantt Chart, ...)   |   40+ Praktisch Formules (Bereken leeftijd op basis van verjaardag, ...)   |   19 Invoeging Tools (QR-code invoegen, Afbeelding invoegen vanaf pad, ...)   |   12 Camper ombouw Tools (Getallen naar woorden, Currency Conversion, ...)   |   7 Samenvoegen en splitsen Tools (Geavanceerd Combineer rijen, Gespleten cellen, ...)   |   ... en meer

Geef uw Excel-vaardigheden een boost met Kutools voor Excel en ervaar efficiëntie als nooit tevoren. Kutools voor Excel biedt meer dan 300 geavanceerde functies om de productiviteit te verhogen en tijd te besparen.  Klik hier om de functie te krijgen die u het meest nodig heeft...

Omschrijving


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 honderden muisklikken voor u elke dag!
Comments (51)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
è possível realizar apenas em uma linha ou coluna específica?
This comment was minimized by the moderator on the site
Hi RAPHAEL,
If you only want to disable the Cut, Copy and Paste options in a certian column or row, the following VBA codes can help.
1. Open the worksheet (such as Sheet1) where you want to disable these options in a certian column or row, right click the sheet tab and click View Code from the right-clicking menu.
2. Copy the following VBA code to the Worksheet (Code) window.
Note: In the code, "Sheet1!$D:$D" stand for the sheet name and the column. You can change it to the sheet name and column of your own.
If you need to disable a row (such as row 3) in that worksheet, change $D:$D to 3:3.
Worksheet (Code) editor:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
    Dim Rg As Range
    Dim xRg As Range

    Set xRg = Range("Sheet1!$D:$D")
    Set Rg = Intersect(ActiveWindow.RangeSelection, xRg)
    If Rg Is Nothing Then
        Application.OnKey "^c"
    Else
        Application.CutCopyMode = False
        Application.OnKey "^c", ""
        Application.CellDragAndDrop = False
    End If

End Sub

3. Stay in the Visual Editor, double click ThisWorkbook in the left pane, and then copy the following code into the ThisWorkbook (code) window.
4. Press the Alt + Q keys to close the Visual Editor.
ThisWorkbook (Code) editor:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
    Dim Rg As Range
    Dim xRg As Range

    Set xRg = Range("Sheet1!$D:$D")
    Set Rg = Intersect(ActiveWindow.RangeSelection, xRg)
    If Rg Is Nothing Then
        Application.OnKey "^c"
    Else
        Application.CutCopyMode = False
        Application.OnKey "^c", ""
        Application.CellDragAndDrop = False
    End If


End Sub
This comment was minimized by the moderator on the site
É possível desabilitar a tecla de atalho ctrl+D?
This comment was minimized by the moderator on the site
I added the code but if I want to re-enable it how should I do it, please help immediately.
This comment was minimized by the moderator on the site
Just save it as a file without macros (.xlsx)
This comment was minimized by the moderator on the site
Hi! Is it possible to leave separate cells available for editing/copying/pasting but all the other cells on the same sheet should keep protected from all the actions mentioned before. If yes - how to do that? 
This comment was minimized by the moderator on the site
Is it possible to leave separate cells available for copying/pasting/editing? All the other cells on this sheet should be protected from the mentioned action
This comment was minimized by the moderator on the site
I have multiple sheet in my workbook & i want to use this code for one sheet only....i want to paste in worksheet module not in the workbook........can someone please modify it only for a worksheet
This comment was minimized by the moderator on the site
Hi, Shift to the worksheet where you want to disable the Cut, Copy And Paste Functions, right click the sheet tab and then copy and paste the VBA below into the Sheet (Code) window. Then the Cut, Copy And Paste functions will be disabled only in this sheet.<div data-tag="code">Private Sub Worksheet_Activate()
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub

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

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

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

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

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

Private Sub Worksheet_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub
This comment was minimized by the moderator on the site
Hi,
I tried this vba code for sheet 7 ( for example)
But it does not work on sheet 7 and only work when I copy a cell from the sheet 7 to another sheet so does not allow to paste in another sheet.
This comment was minimized by the moderator on the site
thnk u so much....it make my work very easy & also i learned ...thnks
This comment was minimized by the moderator on the site
I have multiple sheet in my workbook & i want to use this code for one sheet only...can someone please modify it only for a worksheet
This comment was minimized by the moderator on the site
hi sir, can you please change it only for worksheet
This comment was minimized by the moderator on the site
Is there a way to allow copy pasting on another workbook? The only thing I don't want is pasting in this workbook. Thank you
This comment was minimized by the moderator on the site
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?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations