im_kaushal
New Member
- Joined
- May 8, 2010
- Messages
- 27
Hi All,
How can I make my macro to run everytime I Double-Click on the cell "A2".
How can I make my macro to run everytime I Double-Click on the cell "A2".
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Address <> "$A$2" Then Exit Sub
'your code
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.EnableEvents = False
If Target.Cells.Count = 1 And Target.Address = "$A$2" Then
If Target = "" Then
Columns("f:T").EntireColumn.Hidden = False
ElseIf LCase(Target.Value) = "h" Then
Columns("F:k").EntireColumn.Hidden = True
ElseIf LCase(Target.Value) = "2q" Then
Columns("B:G").EntireColumn.Hidden = True
End If
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("A1:O100")) Is Nothing Then Exit Sub
Cancel = True
Columns("F:K").Hidden = True
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("A1:O100")) Is Nothing Then Exit Sub
Cancel = True
Columns("F:K").Hidden = False
End Sub