+ Reply to Thread
Results 1 to 2 of 2

VBA code to launch macro on another worksheet and generate pivot tables

  1. #1
    Forum Contributor
    Join Date
    06-22-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    152

    VBA code to launch macro on another worksheet and generate pivot tables

    Hi,

    I am very new to VBA and am trying to allow users to press a button on one page that will launch a macro for a different worksheet. I intend to assign a button for them to press that will generate a new worksheet for each inputter. I modified the code after creating a macro for it. The macro works fine when I run from the active sheet. I can't figure out how to change the code so that it runs from anywhere in the workbook. It is failing at the section in bold. My worksheet name is 'Pivot' and the pivot table itself is called 'MainPivot'. My apologies I can't upload my workbook. I am restricted because of security at work.

    Sub PivotMacro()

    Range("A4").Select
    ActiveSheet.PivotTables("MainPivot").PivotCache.Refresh
    ActiveSheet.PivotTables("MainPivot").ShowPages PageField:="Inputter_Name"
    End Sub

    any help greatly appreciated

  2. #2
    Forum Contributor
    Join Date
    06-22-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    152

    Re: VBA code to launch macro on another worksheet and generate pivot tables

    Don't worry. Figured it out by modifying some code I saw on other threads. Thanks anyway!

+ 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