Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Double Click Macro

Latest post Mon, Jun 21 2010 6:52 AM by Roger Govier. 5 replies.
  • Sun, Jun 20 2010 12:23 PM

    • Doc
    • Top 200 Contributor
    • Joined on Fri, Jun 4 2010
    • Posts 5
    • Points 52

    Double Click Macro

    I want to enable a double click macro for cells within a certain range within a table only. Currently I can assign a cell range.....

     

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
       
        If Not Intersect(Target, Range("H2:H50")) Is Nothing _
        And Not Target.Count > 1 Then
            Call HowManyUsed
            Cancel = True
        ElseIf Not Intersect(Target, Range("I2:I50")) Is Nothing _
        And Not Target.Count > 1 Then
            Call HowManyUsed
            Cancel = True
        End If
    End Sub

     

    I would like to use Table1 Header Used, Repaired, ect. Any suggestions?

     

    • Post Points: 21
  • Sun, Jun 20 2010 7:39 PM In reply to

    Something like this

     

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
      
        If Not Intersect(Target, Me.Range("Table1[[#All],[Used]]")) Is Nothing _
         And Not Target.Count > 1 Then
            Call HowManyUsed
            Cancel = True
        ElseIf Not Intersect(Target, Me.Range("Table1[[#All],[Repaired]]")) Is Nothing _
        And Not Target.Count > 1 Then
            Call HowManyUsed
            Cancel = True
        End If
    End Sub

    Regards

    Bob

    • Post Points: 37
  • Sun, Jun 20 2010 10:51 PM In reply to

    • Doc
    • Top 200 Contributor
    • Joined on Fri, Jun 4 2010
    • Posts 5
    • Points 52

    Thanks Bob worked great!

    • Post Points: 5
  • Mon, Jun 21 2010 5:44 AM In reply to

    • Roger Govier
    • Top 10 Contributor
    • Joined on Wed, Jan 9 2008
    • Abergavenny, South Wales, UK
    • Posts 149
    • Points 2,288
    • MVP

    Hi Bob

    I know it's the longest day, but there is no need to rush through it!!!
    Check your time!

    Regards
    Roger Govier
    Microsoft Excel MVP

    • Post Points: 21
  • Mon, Jun 21 2010 5:58 AM In reply to

    What is wrong with it?

    Regards

    Bob

    • Post Points: 21
  • Mon, Jun 21 2010 6:52 AM In reply to

    • Roger Govier
    • Top 10 Contributor
    • Joined on Wed, Jan 9 2008
    • Abergavenny, South Wales, UK
    • Posts 149
    • Points 2,288
    • MVP

    Hi Bob

    Apologies

    It's me - I can't tell the time!!!!
    I read 12:39 Am as being 12:39 PM - obviously not fully awake!

    Where is that coffee pot?

    Regards
    Roger Govier
    Microsoft Excel MVP

    • Post Points: 5
Page 1 of 1 (6 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.