Cell Double Click Event Procedure

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Cell Double Click Event Procedure

Post by adam »

HI anyone,

I'm trying to figure out a macro code that would copy the content of the cell E9 from the sheet CustomerList to the cell I10 of the sheet Invoice; and clear the cell E9 when the user double clicks the cell E9.

I hope I've made my question clear.

Any help on this would be kindly appreciated.

Thanks in advance.
Best Regards,
Adam

User avatar
Jan Karel Pieterse
Microsoft MVP
Posts: 656
Joined: 24 Jan 2010, 17:51
Status: Microsoft MVP
Location: Weert, The Netherlands

Re: Cell Double Click Event Procedure

Post by Jan Karel Pieterse »

Right-click the tab of the CustomerList sheet and select "View code".
Paste this code:

Code: Select all

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Intersect(Target, Me.Range("E9")) Is Nothing Then Exit Sub
    'Cancel what normally happens after a double-click (edit cell)
    Cancel = True
    Me.Range("E9").Copy Destination:=Worksheets("Invoice").Range("I10")
End Sub
Regards,

Jan Karel Pieterse
Excel MVP jkp-ads.com

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Cell Double Click Event Procedure

Post by adam »

Thanks for the help Jan Karel Pieterse. I do really appreciate your help.
Best Regards,
Adam