+ Reply to Thread
Results 1 to 2 of 2

Double Click on cell to run Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    1

    Double Click on cell to run Macro

    Hi,

    I am trying to run a macro when I double click on a certain cell (D34). The cell has data in it (Southeast NSC). What Im expecting to happen is once I double click on the cell the macro will run the retrieve and I will end up at expense chart page.

    The macro I am trying to run is an Essbase retrieve.

    Sub Drill_Down()
    
        application.Goto Reference:="Chart_Retrieve"
        x = EssMenuVRetrieve()
        range("A3").Select
       
        
     Sheets("Expense Chart").Select
        range("a3").Select
        
     range("B5").Select
        ActiveSheet.PivotTables("PivotTable5").PivotCache.Refresh
        range("C26").Select
        ActiveSheet.PivotTables("PivotTable6").PivotCache.Refresh
        
     Sheets("Expense Chart").Select
        range("f1").Select
        
    End Sub

    I tried using the macro below but no luck:

    Private Sub Worksheet_SelectionChange(ByVal Target As range)
    If Intersect(Target, range("C34:D34")) Is Nothing Then Exit Sub
    Call Drill_Down
    End Sub
    and i tried:

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As range, Cancel As Boolean)
    
       Select Case Target.Address
          Case Sheets("Forecast Dashboard").Select
                range("D34").Select
             Cancel = True
             Run ([Drill_Down])
          
       End Select
    End Sub
    Please Help
    Last edited by armand36; 05-22-2014 at 01:11 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    If the code for the sub Drill_Down is in a standard module this is all you should need to call it.
     
    Call Drill_Down
    If want to check the cell that was double clicked is D34 them use this
    If Target.Address = "$D$34" Then
    So combined.
     
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As range, Cancel As Boolean)
    
       If Target.Address = "$D$34" Then
             Cancel = True
             Call Drill_Down
       End If
          
    End Sub
    PS Can you use code tags when posting code?
    Last edited by Norie; 05-22-2014 at 12:43 PM.
    If posting code please use code tags, see here.

+ 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. Changing cell properties with double click, then revert with another double click
    By mweber2525 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-01-2014, 01:40 PM
  2. Macro to filter on double click on cell
    By jw01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2013, 09:19 AM
  3. [SOLVED] Run macro on cell double click! - Half way there
    By jlab89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2012, 12:39 AM
  4. Double-click on cell to run macro
    By cad1llac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-30-2010, 04:57 AM
  5. [SOLVED] How to call a sub defined in macro when double click a cell?
    By Ivan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2005, 05:50 PM

Tags for this Thread

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