Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
'Const MOUSEEVENTF_RIGHTDOWN As Long = &H8
'Const MOUSEEVENTF_RIGHTUP As Long = &H10
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With ActiveWindow.ActivePane
Z = (ActiveWindow.Zoom) / 100
dpi = ((((.PointsToScreenPixelsY(72) - .PointsToScreenPixelsY(0)) / 72) / Z) * 72)
X = Round(.PointsToScreenPixelsX(Target.Offset(, 1).Left) - 1 * (dpi / 100), 0)
Y = Round(.PointsToScreenPixelsY(Target.Top) + 2 * (dpi / 100), 0)
End With
ExecuteExcel4Macro ("CALL(""user32"",""SetCursorPos"",""JJJJJ""," & X & ", " & Y & ")")
ExecuteExcel4Macro ("CALL(""user32"",""mouse_event"",""JJJJJJ""," & MOUSEEVENTF_LEFTDOWN & ", " & 0 & ", " & 0 & ", " & 0 & ", " & 0 & ")")
ExecuteExcel4Macro ("CALL(""user32"",""mouse_event"",""JJJJJJ""," & MOUSEEVENTF_LEFTUP & ", " & 0 & ", " & 0 & ", " & 0 & ", " & 0 & ")")
End Sub