Forum Discussion
Preshti157
Apr 18, 2023Copper Contributor
Macros on Excel
Hello! We have an excel sheet which collects data daily, at the end of the week, an average is calculated. When the cell (which has the average written in it) is double clicked, a prompt appears a...
HansVogelaar
Apr 18, 2023MVP
Code that runs automatically when a cell is double-clicked is a Worksheet_BeforeDoubleClick event procedure, not a "normal" macro.
To inspect the code, right-click the sheet tab and select 'View Code' from the context menu.
Look for
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
...
End Sub
You can copy this procedure, and paste it into the worksheet module of another worksheet, then modify it to suit your needs.
Don't forget to save the workbook into which you copied the code as a macro-enabled workbook (*.xlsm).