Private Sub Worksheet_SelectionChange(ByVal Target As Range) MsgBox Target.Address(0,0) End Sub
Private Sub Worksheet_Activate() End Sub
Private Sub Worksheet_Deactivate() Sheets("Deactivate").Visible = false; End Sub
Private Sub Worksheet_BeforeDelete() ... End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address(0,0) = "C3" Then MsgBox "C3 double clicked" ' disable cell editing Cancel = True End Sub End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) If Target.Address(0,0) = "C3" Then MsgBox "C3 right clicked" ' prevent context menu from appearing Cancel = True End Sub End Sub
Private Sub Worksheet_Calculate() Columns("A:B").AutoFit End Sub
Sub disableEvents() Application.EnableEvents = False End Sub Sub enableEvents() Application.EnableEvents = True End Sub
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 2 Then If Target.Offset(0, -1) = "Bertha" Then ' prevent endless loop by turning off events Application.EnableEvents = False ' change event won't be fired by this change Target = 0.5 ' turn events on Application.EnableEvents = True End If End If End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("b2:b4")) Is Nothing Then ' the target is within the range End If End Sub
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) ... End Sub
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("B:C")) Is Nothing Then rowNumber = Target.Row s = Range("A" & rowNumber).Value If s <> "" Then x = Range("C" & rowNumber).Value y = Range("B" & rowNumber).Value Range("D" & rowNumber) = x * y End If End If End Sub