禁止EXCEL单元格粘贴和拖放,只允许手动输入
作者:互联网
Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Application.Intersect(Target, Range("F10:M26,D2")) Is Nothing Then MsgBox ("禁止粘贴内容!,请双击后输入内容!") Application.CellDragAndDrop = False Else Application.CellDragAndDrop = True End If End Sub Private Sub Worksheet_Deactivate() Application.CellDragAndDrop = True End Sub
注意:Range("F10:M26,D2") 为指定的禁止粘贴的区域。只能手动输入。
标签:粘贴,End,Sub,单元格,EXCEL,Application,Range,CellDragAndDrop,拖放 来源: https://www.cnblogs.com/JoePotter/p/15077756.html