Trigger macro with ONE click on specific cell
Would you mind pointing a way to start a macro in Excel 2010 by clicking only once on a specified cell? I had seen a solution somewhere, but now I can't trace it back.
Solution 1:
The following code will fire when cell D4 is clicked in the worksheet.
Right-click the sheet tab and select "View Code". Paste this into the code window:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("D4")) Is Nothing Then
MsgBox "Hello World"
End If
End If
End Sub
Adjust the cell reference from "D4" to reflect your desired cell. Replace the MsgBox line with your desired code.