Microsoft Office Tutorials and References
In Depth Information
Examining Worksheet Events
Figure 19-8: Moving the cell cursor causes the active cell’s row and column to be shaded.
The BeforeDoubleClick event
You can set up a VBA procedure to be executed when the user double-clicks a cell. In the
following example (which is stored in the Code window for a Sheet object), double-clicking a cell
toggles the cell’s style. If the cell style is “Normal” , it applies the “Good” style. If the style is
“Good” , it applies the “Normal” style.
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Excel.Range, Cancel As Boolean)
If Target.Style = “Good” Then
Target.Style = “Normal”
Else
Target.Style = “Good”
End If
Cancel = True
End Sub
If Cancel is set to True , the default double-click action doesn’t occur. In other words,
doubleclicking the cell won’t put Excel into cell edit mode.
 
Search JabSto ::




Custom Search