Table of Contents

BeforeDoubleClick Event

Code added to the Worksheet BeforeDoubleClick Event will be executed by Excel VBA when you double click a cell on a worksheet.

1. Open the Visual Basic Editor.

2. Double click on a sheet (for example Sheet1) in the Project Explorer.

3. Choose Worksheet from the left drop-down list. Choose BeforeDoubleClick from the right drop-down list.

Worksheet BeforeDoubleClick Event in Excel VBA

Note: the ‘_’ symbol is used to continue the statement on a new line (in order to show you the complete code).

Add the following code lines to the Worksheet BeforeDoubleClick Event:

4. The code line below colors the active cell red.

Target.Font.Color = vbRed

5. Set the Cancel argument to true if you don’t want the default double click action (cell edit mode) to occur.

Cancel = True

6. Test the program by double clicking a cell on Sheet1.

Result:

Worksheet BeforeDoubleClick Event Result

Leave A Comment

Excel meets AI – Boost your productivity like never before!

At Formulas HQ, we’ve harnessed the brilliance of AI to turbocharge your Spreadsheet mastery. Say goodbye to the days of grappling with complex formulas, VBA code, and scripts. We’re here to make your work smarter, not harder.

Related Articles

The Latest on Formulas HQ Blog