+ 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
    303

    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
    Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    250

    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,155

    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
    10,387

    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,155

    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,155

    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
    10,387

    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,155

    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
    303

    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,155

    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)

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