Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA and Pivot Tables


Hi all, first post so please be gentle! :)

I'm currently putting together a VBA Macro to allow less Excel minded
people to use a complex pivot table. I am able to get the macro to run
as I want it to, except I cannot find the right way to allow the user to
enter variables on a front sheet that will then be picked up by the
macro and then the right pivot table function selected. I currently
have:

Range("A8").Select
With ActiveSheet.PivotTables("PivotTable2").CubeFields( "[DATE]")
..Orientation = xlPageField
..Position = 1
End With

ActiveSheet.PivotTables("PivotTable2").PivotFields ("[DATE]").CurrentPageName
= _
"[DATE].[All DATE].[2006].[January]"
Columns("A:A").ColumnWidth = 18.71
With
ActiveSheet.PivotTables("PivotTable2").CubeFields( "[ACCESS_CAMPAIGN]")
..Orientation = xlPageField
..Position = 2
End With

ActiveSheet.PivotTables("PivotTable2").PivotFields ("[ACCESS_CAMPAIGN]").
_
CurrentPageName = "[ACCESS_CAMPAIGN].[All
ACCESS_CAMPAIGN].[0844]"

etc etc etc

However, where it selects [0844] above, I would like this to select
whatever value is shown in cell C3 of the worksheet called 'Inputs'
instead.

Is this possible?

Thanks in advance

Stu


--
Stu-Pid
------------------------------------------------------------------------
Stu-Pid's Profile: http://www.excelforum.com/member.php...o&userid=30823
View this thread: http://www.excelforum.com/showthread...hreadid=504869

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA and Pivot Tables

Possibly

s = worksheets("Inputs").Range("C3").Value
CurrentPageName = _
"[ACCESS_CAMPAIGN].[All ACCESS_CAMPAIGN].[" _
& s & "]"

--
Regards,
Tom Ogilvy


"Stu-Pid" wrote in
message ...

Hi all, first post so please be gentle! :)

I'm currently putting together a VBA Macro to allow less Excel minded
people to use a complex pivot table. I am able to get the macro to run
as I want it to, except I cannot find the right way to allow the user to
enter variables on a front sheet that will then be picked up by the
macro and then the right pivot table function selected. I currently
have:

Range("A8").Select
With ActiveSheet.PivotTables("PivotTable2").CubeFields( "[DATE]")
Orientation = xlPageField
Position = 1
End With


ActiveSheet.PivotTables("PivotTable2").PivotFields ("[DATE]").CurrentPageName
= _
"[DATE].[All DATE].[2006].[January]"
Columns("A:A").ColumnWidth = 18.71
With
ActiveSheet.PivotTables("PivotTable2").CubeFields( "[ACCESS_CAMPAIGN]")
Orientation = xlPageField
Position = 2
End With

ActiveSheet.PivotTables("PivotTable2").PivotFields ("[ACCESS_CAMPAIGN]").
_
CurrentPageName = "[ACCESS_CAMPAIGN].[All
ACCESS_CAMPAIGN].[0844]"

etc etc etc

However, where it selects [0844] above, I would like this to select
whatever value is shown in cell C3 of the worksheet called 'Inputs'
instead.

Is this possible?

Thanks in advance

Stu


--
Stu-Pid
------------------------------------------------------------------------
Stu-Pid's Profile:

http://www.excelforum.com/member.php...o&userid=30823
View this thread: http://www.excelforum.com/showthread...hreadid=504869



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA and Pivot Tables


Thanks for the reply.

It seems to work perfectly, many thanks! :

--
Stu-Pi
-----------------------------------------------------------------------
Stu-Pid's Profile: http://www.excelforum.com/member.php...fo&userid=3082
View this thread: http://www.excelforum.com/showthread.php?threadid=50486

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Building pivot tables in Excel 2007 based on existing pivot tables? [email protected] Excel Discussion (Misc queries) 4 December 26th 07 08:05 PM
Pivot Table Data Adding contents of two pivot tables and param que Roundy Excel Discussion (Misc queries) 0 July 2nd 07 10:20 PM
Average Calculations from Pivot Tables - Get Pivot Data? Calc Fiel westy Excel Worksheet Functions 5 March 10th 07 01:31 AM
How does the term 'pivot' apply to Excel's Pivot tables and Pivot. stvermont Excel Discussion (Misc queries) 1 February 17th 05 01:34 AM
Pivot tables-controlling user interaction with pivot tables Sindhura Excel Programming 0 August 27th 03 02:10 PM


All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"