Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel2007 VBA - dates in Pivot Tables not read in correct format

If I create a PivotTable with a field called DATE containing dates formatting
as dd/mm/yy, I then use this macro to remove Saturdays and Sundays from the
PivotTable. Except it reads the dates a mm/dd/yy until they are 'out of
scope' and then they are read as dd/mm/yy. Why?

Sub HideWeekendsFromPivotTable()
Dim pivotName As String
Dim pivotDate As Date
Dim z, pivotCount As Long

pivotName = ActiveSheet.PivotTables(1).Name

With ActiveSheet.PivotTables(pivotName).PivotFields("Da te")
pivotCount = .PivotItems.Count

For z = 1 To pivotCount

If Weekday(.PivotItems(z).Name) = 1 Or
Weekday(.PivotItems(z).Name) = 7 Then _
.PivotItems(z).Visible = False

Next z
End With
End Sub
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
Pivot Chart Dates not in correct order ls Charts and Charting in Excel 3 July 14th 09 07:06 PM
my pivot tables are correct but my totals and GT don't show muzikman360 Excel Discussion (Misc queries) 2 February 2nd 07 06:52 PM
Anyone seen Pivot Tables with incorrect detail but correct total? mickee Excel Discussion (Misc queries) 0 July 17th 06 08:25 PM
Why do pivot tables not read numbers that are copied and pasted B_4j Excel Discussion (Misc queries) 1 June 23rd 05 11:10 PM
pivot table dates are out of order how do I correct them D Beals Excel Worksheet Functions 3 May 18th 05 05:55 PM


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