Couper coller ref

csr

XLDnaute Nouveau
Bonjour à tous

C'est ma première question sur ce forum.
J'ai créé un planning gestion du personnel avec de nombreuses conditions,tout fonctionne correctement à condition de faire copier/coller à l'inetrieur des cases représentant les jours de l'année.
Je me suis vite aperçu que certains utilisateurs faisaient des couper coller et là!!!! les formules excel n'aiment pas,d'ou resultat erroné " REF" dans les formules.
Je cherche évidament des solutions.
Ma premiére idée,serait-il possible avec une formule magique " VB
que je ne maîtrise pas" d'interdir tous les "copier coller"possibles,souris,clavier et autres.

Merci
 

csr

XLDnaute Nouveau
Re : Couper coller ref

MERCI POUR TA REPONSE

Option Explicit

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
On Error Resume Next
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

AS-TU REUSSI A FAIRE FONCTIONNER CETTE MACRO QUE J'AI TROUVE DANS TON LIEN SI OUI COMMENT ? CAR MOI JE N'AI PAS REUSSI.


AMICALEMENT
 

Discussions similaires

Statistiques des forums

Discussions
312 848
Messages
2 092 788
Membres
105 534
dernier inscrit
EmilieG60