Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Selecting the current month using a macro on a pivot table

I have a macro set to run every day. In the pivot table it chooses Nov. How
can I get this to choose the current month so that I don't have to change it
every month. Also can make the change to current month on the 5th business
day to the current month?

ActiveSheet.PivotTables("PivotTable2").AddFields ColumnFields:= _
"MKT_REGION_NAME "
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("NOV")
.Orientation = xlDataField
.Caption = "Sum of NOV"
.Function = xlSum


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Selecting the current month using a macro on a pivot table

just replace
"NOV"
with
UCase(WorksheetFunction.Text(Now, "mmm"))
--
Gary's Student


"Newbee" wrote:

I have a macro set to run every day. In the pivot table it chooses Nov. How
can I get this to choose the current month so that I don't have to change it
every month. Also can make the change to current month on the 5th business
day to the current month?

ActiveSheet.PivotTables("PivotTable2").AddFields ColumnFields:= _
"MKT_REGION_NAME "
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("NOV")
.Orientation = xlDataField
.Caption = "Sum of NOV"
.Function = xlSum


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Selecting the current month using a macro on a pivot table

Thank you!

"Gary''s Student" wrote:

just replace
"NOV"
with
UCase(WorksheetFunction.Text(Now, "mmm"))
--
Gary's Student


"Newbee" wrote:

I have a macro set to run every day. In the pivot table it chooses Nov. How
can I get this to choose the current month so that I don't have to change it
every month. Also can make the change to current month on the 5th business
day to the current month?

ActiveSheet.PivotTables("PivotTable2").AddFields ColumnFields:= _
"MKT_REGION_NAME "
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("NOV")
.Orientation = xlDataField
.Caption = "Sum of NOV"
.Function = xlSum


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Selecting the current month using a macro on a pivot table

You are very Welcome !
--
Gary's Student


"Newbee" wrote:

Thank you!

"Gary''s Student" wrote:

just replace
"NOV"
with
UCase(WorksheetFunction.Text(Now, "mmm"))
--
Gary's Student


"Newbee" wrote:

I have a macro set to run every day. In the pivot table it chooses Nov. How
can I get this to choose the current month so that I don't have to change it
every month. Also can make the change to current month on the 5th business
day to the current month?

ActiveSheet.PivotTables("PivotTable2").AddFields ColumnFields:= _
"MKT_REGION_NAME "
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("NOV")
.Orientation = xlDataField
.Caption = "Sum of NOV"
.Function = xlSum


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
Count only if another column has data in Pivot Table? [email protected] Excel Worksheet Functions 1 October 10th 06 09:16 PM
How to show month end balances in a Pivot Table stevep Excel Discussion (Misc queries) 1 January 11th 06 03:15 PM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to change a Pivot Table David M Excel Discussion (Misc queries) 0 March 22nd 05 05:27 PM
Pivot Table with Zero Values for Month wyman Charts and Charting in Excel 1 January 14th 05 05:59 PM


All times are GMT +1. The time now is 06:38 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"