Results 1 to 10 of 10

Help converting a workbook function into a Macro

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Help converting a workbook function into a Macro

    Dear Experts
    I found the following workbook function on the web and i dont know how to convert it into a macro. Being a new user of VBA i have tried and failed in last cpl of days
    Option Explicit
    Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    Dim ptTable As PivotTable, strField As String
    strField = "FIELD 1"' I WOULD WANT TO RENAME THIS TO ROUTE instead of FIELD 1
    On Error GoTo ExitPoint
    Application.EnableEvents = False
    For Each ptTable In ActiveSheet.PivotTables
        If ptTable <> Target Then
            ptTable.PageFields(strField).CurrentPage = Target.PageFields(strField).CurrentPage.Value
        End If
    Next ptTable
    ExitPoint:
    Application.EnableEvents = True
    End Sub
    Last edited by VKS; 02-11-2013 at 01:36 PM. Reason: Thanks Norie

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