+ Reply to Thread
Results 1 to 5 of 5

Choose the sheet to let the macro work on

  1. #1
    Registered User
    Join Date
    03-19-2009
    Location
    Arnhem, Holland
    MS-Off Ver
    Excel 2003
    Posts
    35

    Choose the sheet to let the macro work on

    I hope this simplified question can give me some leads:

    I have a macro(running a pivot!), which I want to use on a specific sheet. But the sheet can change. So, I have 4 sheets...and depending on de sheettitle (which I declare in a cell somewhere)

    some sort of dynamic sheet choice...

    I think the clue is in this line:

    Please Login or Register  to view this content.
    Hope somebody can give me leads!
    Last edited by royUK; 03-20-2009 at 04:48 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Choose the sheet to let the macro work on

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    I will add them this time
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Choose the sheet to let the macro work on

    Your code will also need to create a name for the table because that is hard coded as TableName:="PivotTable8"

    Have you read the Excel VBA HelpFiles on CreatePivotTable Method to understand what your code is doing?

  4. #4
    Registered User
    Join Date
    03-19-2009
    Location
    Arnhem, Holland
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Choose the sheet to let the macro work on

    Thx for the replies. I read the forum rules and will keep those in mind.

    About my code: I 'analysed' it and I understand 80% of what it is doing. I failed to make my source-sheet-choice 'dynamic'.

    I understand that the result is in 'pivottable8'. Do I need to change that? The result-pivottable is ok....but the sourcesheet on which the pivot is made should be dynamic...

    Is my problem clear? I can imagine you need more info.

    'STX main diverter is the name of the sheet. I would like to make this dynamic. So: difine the sheetname in a cell...and refer to the cell? But how?

    let me add the whole macro:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-19-2009
    Location
    Arnhem, Holland
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Choose the sheet to let the macro work on

    Quote Originally Posted by royUK View Post
    Your code will also need to create a name for the table because that is hard coded as TableName:="PivotTable8"

    Have you read the Excel VBA HelpFiles on CreatePivotTable Method to understand what your code is doing?
    The helpfile gives alot of information...and in the right direction! thx!
    But I (again) failed to achieve my goal.

    Can you give me advise on how to combine the Excel helpfile advise with my macro above?

    Excel helpfile advise:

    Please Login or Register  to view this content.

+ 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