Excel 禁止 雙擊儲存格邊界
附加壓縮檔: 201704/mobile01-1066a5fe0539d49a8726fcbb9a903117.zip
我有一個 EXCLE 畫面太過密集,經常不小心 雙擊到儲存格的邊界就移到畫面最下面,十分困擾
我上網尋找,最後找到的方式就是將 TOOL->OPTION->EDIT->Allow cell drag and drop(使用儲存格拖放功能) 取消

之後我找到更進一步的設定方式,讓特定區域的 邊界雙擊移動失效
Dim SaveDragAndDrop As Variant 'For persistence, is declared at module level
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'NOTE: This event fires first, then the Worksheet_BeforeDoubleClick event.
'
'WARNING: Setting a breakpoint in this event will, in effect, cancel any BeforeDoubleClick event, so you can't
' single-step through the whole sequence!
'To prevent unwanted jumping to the "End" of a data-set if the user accidentally double-clicks onto the cell
'border (which is an effect of CellDragAndDrop), disable that functionality while in the range where that
'behavior is a problem.
If Not Intersect(Target, Range("MyProtectedRange")) Is Nothing Then
If IsEmpty(SaveDragAndDrop) Then
SaveDragAndDrop = Application.CellDragAndDrop
Application.CellDragAndDrop = False
End If
Else
If Not IsEmpty(SaveDragAndDrop) Then
Application.CellDragAndDrop = SaveDragAndDrop
SaveDragAndDrop = Empty
End If
End If
End Sub
名稱 MyProtectedRange =Sheet1!$C$4:$F$16
Book_ok.xls 點選黃色部份, 雙擊到儲存格的邊界 失效
點選空白儲存格,雙擊邊界移動的功能 有效
但是這個程式有BUG ,當我點黃色後(失效),再移到 SHEET2 就通通失效了,必需移回SHEET1,再點選白色儲存可才會再生效。
所以我將 SelectionChange 移到 ThisWorkBook 變成 SheetSelectionChange
但是 Intersect 卻有問題,請問那有問題?應該怎麼修改才能正確
附加壓縮檔: 201704/mobile01-1066a5fe0539d49a8726fcbb9a903117.zip