+ Reply to Thread
Results 1 to 10 of 10

getting a second BeforeDoubleClick to work on the same sheet

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    McAllen TX
    MS-Off Ver
    Excel 2007
    Posts
    389

    getting a second BeforeDoubleClick to work on the same sheet

    I have a sheet that the following works great on ...

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("B33:B44")) Is Nothing Then
    Application.EnableEvents = False
    If ActiveCell.Value = ChrW(&H2713) Then
    ActiveCell.ClearContents

    Else
    ActiveCell.Value = ChrW(&H2713)
    End If
    Cancel = True
    End If
    Application.EnableEvents = True
    End Sub
    so on the same worksheet i would like to get the Dble Click to fire a copy and paste (value only) COPY from cells A63:A65 (depending on which cell i dble click) and PASTE to cell F60 on the same sheet... i have the following, no error but it doesn't do anything that i can tell.

    Private Sub Worksheet_BeforeDoubleClick2(ByVal Target As Range, Cancel As Boolean)
    If Not Active(Target, ("A63:A65")) Is Nothing Then
    Application.EnableEvents = False
    If ActiveCell Then
    ActiveCell.ClearContents
    Else
    Selection.Copy
    Range("F60").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
    , AllowFiltering:=True
    End If
    Application.EnableEvents = True
    End Sub
    I obviously dont know what i am doing please help...

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: getting a second BeforeDoubleClick to work on the same sheet

    You can't make up your own Events - i.e. Worksheet_BeforeDoubleClick2. That code will never run.

    It's not clear to me what you want to do, but I hope the following will be of assistance:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: getting a second BeforeDoubleClick to work on the same sheet

    It wont fire because of the 2 after BeforeDoubleClick. For an event to happen as it should, the name of the event cannot be altered. Having said that, removing the 2 does allow the code to fire, but it has errors in it.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: getting a second BeforeDoubleClick to work on the same sheet

    You can't have two - you need to combine them - Maybe:

    Please Login or Register  to view this content.
    Last edited by xladept; 03-19-2017 at 07:29 PM. Reason: Propriety
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: getting a second BeforeDoubleClick to work on the same sheet

    I see that mgs73 is all over it already.

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: getting a second BeforeDoubleClick to work on the same sheet

    And XLadept as well. Although, I think there is a bit missing on this line..
    Please Login or Register  to view this content.
    I think it should be
    Please Login or Register  to view this content.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: getting a second BeforeDoubleClick to work on the same sheet

    @ gmr4evr1 - got it

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: getting a second BeforeDoubleClick to work on the same sheet

    Okie dokie

  9. #9
    Forum Contributor
    Join Date
    04-30-2013
    Location
    McAllen TX
    MS-Off Ver
    Excel 2007
    Posts
    389

    Re: getting a second BeforeDoubleClick to work on the same sheet

    THANKS guys YES all of you were all over it... I copied and pasted MGS' and all was perfect... wish I would have asked before I struggled with it for 2 hrs.

  10. #10
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: getting a second BeforeDoubleClick to work on the same sheet

    Glad it worked for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 11-29-2015, 09:33 PM
  2. [SOLVED] Formula in one work sheet wont accept result from another in a different work sheet.
    By Belinea2010 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-07-2015, 12:24 PM
  3. [SOLVED] copy work sheet from another work book into already exits sheet
    By Baskar5353 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2015, 03:18 AM
  4. [SOLVED] Worksheet Module, Unprotect and Protect Sheet, BeforeDoubleClick
    By gjohn282 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2012, 03:38 PM
  5. BeforeDoubleClick bug
    By bsalonzo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2007, 06:51 PM
  6. BeforeDoubleClick Event on Protected Sheet
    By jasoncw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2007, 09:12 PM
  7. Replies: 1
    Last Post: 10-29-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1