• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel VBA Macro

Status
Not open for further replies.
Hi,

My data sheet consits of Current week (CW) 44,45,46 etc and Task code A,B,C,D etc. Want to know for Current week-44 how may task A,B,C completed then CW-45 how many task B,C,D completed then so on.... In pivot Table Report Filter filed column draging "Current week", Row Lable "Task code" and Values Field "Count of Task Code". The Task code of Row leble is not getting exuceted while runnig the macro but values filed working perfectly. Any body please help me to solve the problem.

Thank you in advance for your help and support.

CODE


Sub Pivottable()
'
' Pivottable Macro
'

'
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Data-CW-44!R165C1:R307C35", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Sangram!R5C2", TableName:="PivotTable1" _
, DefaultVersion:=xlPivotTableVersion14
Sheets("Sangram").Select
Cells(5, 2).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("CW")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Task Code")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Task Code"), "Count of Task Code", xlCount
End Sub
 
Status
Not open for further replies.
Back
Top