简体   繁体   中英

Use Ctrl as modifier on Worksheet_SelectionChange

I would like to open a form when a locked cell is clicked in a specific way (double click, key modifiers, etc).

If I use Worksheet_BeforeDoubleClick , it will show a warning after closing the form, stating that the cell is locked (which is annoyting).

If I use Worksheet_SelectionChange , no warning will appear, but the form will appear every time a cell is selected (which is a bit much).

Is there anyway to use a modifier, like Ctrl , combined with Worksheet_SelectionChange , so that the user has to make an active choice to open the form?

Just set Cancel = True at the end of your Worksheet_BeforeDoubleClick sub.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    MsgBox "test"
    Cancel = True
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM