Results 1 to 5 of 5

Event handler

Threaded View

VBA Noob Event handler example for... 04-26-2006, 06:22 AM
Guest RE: Event handler 04-26-2006, 08:10 AM
VBA Noob Hi K Dale, Thanks for this... 04-26-2006, 09:32 AM
Guest Re: Event handler 04-26-2006, 10:55 AM
Guest RE: Event handler 04-26-2006, 08:15 AM
  1. #1
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Event handler example for Pivot

    Posted: Thu Apr 27, 2006 7:23 pm Post subject: Example of a Event Handlers for pivot Tables

    --------------------------------------------------------------------------------

    Hi all,

    Think i've cracked it. My macro is called Fillcolors

    Code:

    Option Explicit
    Public mSheet As String

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, _
    Cancel As Boolean)

    Dim curCell As String, ptname As String, a As Integer

    Start:
    If ActiveSheet.PivotTables.Count = 0 Then GoTo NoPT

    On Error GoTo NoPT
    If IsEmpty(Target) And ActiveCell.PivotField.Name <> "" Then
    Cancel = True
    GoTo NoPT
    End If
    mSheet = ActiveSheet.Name
    curCell = ActiveCell.Address
    ptname = Sh.Range(curCell).PivotTable

    If ActiveSheet.PivotTables(ptname).EnableDrilldown Then
    Selection.ShowDetail = True
    Call FillColors
    mSheet = ActiveSheet.Name

    NoPT:
    On Error GoTo 0

    End Sub



    Thanks

    VBA Noob



    Hi,

    Looking for excel to activate a macro when a user double clicks on a pivot table to drill down into what makes up the total. Think I need something like the beliow to call my macro called FillColours.

    Does anyone have any thoughts ??


    VBA:

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, _
    Cancel As Boolean)


    If ActiveSheet.PivotTables.EnableDrilldown = True Then Call FillColours

    End Sub

    Thanks
    VBA Noob
    Last edited by VBA Noob; 04-28-2006 at 02:48 PM. Reason: Solution found

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