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") 為指定的禁止粘貼的區域。只能手動輸入。