Reputation: 57
I'm trying to start a macro through double clicking a cell.
I copied this code directly from the internet, but it is not working when I double click the cell C40.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("C40")) Is Nothing Then
Cancel = True
SelectPayFreq.Show
End If
End Sub
Upvotes: 3
Views: 29593
Reputation: 3940
The code for worksheet events must be placed in the module for a proper worksheet not in a regular module.
Upvotes: 5
Reputation: 96753
Make sure the code is in the worksheet code area:
Because it is worksheet code, it is very easy to install and automatic to use:
Upvotes: 4