Hi all,
can anybody help me ?
I want a VBA code to run after double/single click on a cell of
worksheet.
eg. after double/single click on a cell a msgbox will appear with th
sum of two other cell values.Please help me how to write this VBA cod
in excell

--
sdebu_200
-----------------------------------------------------------------------
sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=430
View this thread: http://www.officehelp.in/showthread.php?t=119212

Posted from - http://www.officehelp.i

Re: double click event for a cell in a worksheet by Bob

Bob
Thu Sep 07 12:39:44 CDT 2006

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Const WS_RANGE As String = "H1:H10"

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
MsgBox Target.Offset(0, -2).Value + Target.Offset(0, -1).Value
End If

ws_exit:
Application.EnableEvents = True

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

This works on a double-click on any of H1:H10, and shows the sum in the
preceding two columns.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sdebu_2000" <sdebu_2000.2drxme@NoSpamPleaze.com> wrote in message
news:sdebu_2000.2drxme@NoSpamPleaze.com...
>
> Hi all,
> can anybody help me ?
> I want a VBA code to run after double/single click on a cell of a
> worksheet.
> eg. after double/single click on a cell a msgbox will appear with the
> sum of two other cell values.Please help me how to write this VBA code
> in excell.
>
>
> --
> sdebu_2000
> ------------------------------------------------------------------------
> sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=4308
> View this thread: http://www.officehelp.in/showthread.php?t=1192122
>
> Posted from - http://www.officehelp.in
>



Re: double click event for a cell in a worksheet by Bernie

Bernie
Thu Sep 07 12:46:34 CDT 2006

You could use something like this, to show the sum of the cell that is clicked and the cell to its
left....

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
MsgBox Target.Value + Target(1, 0).Value
Cancel = True
End Sub

Take out the Cancel = True if you want to edit the cell after double clicking it... If you need
help figuring out how to sum the "two other cells" then you'll need a better description of how to
find those cells....

Copy the code, rt-click the sheet tab, select "View Code" and paste in the window that appears.

HTH,
Bernie
MS Excel MVP


"sdebu_2000" <sdebu_2000.2drxme@NoSpamPleaze.com> wrote in message
news:sdebu_2000.2drxme@NoSpamPleaze.com...
>
> Hi all,
> can anybody help me ?
> I want a VBA code to run after double/single click on a cell of a
> worksheet.
> eg. after double/single click on a cell a msgbox will appear with the
> sum of two other cell values.Please help me how to write this VBA code
> in excell.
>
>
> --
> sdebu_2000
> ------------------------------------------------------------------------
> sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=4308
> View this thread: http://www.officehelp.in/showthread.php?t=1192122
>
> Posted from - http://www.officehelp.in
>