Prev: Excel pop3 issue
Next: timer in IE
From: Kenneth A. Larsen on 28 Jul 2010 19:47 "OldDog" <mikef2691(a)comcast.net> wrote in message news:508ad167-4090-4537-9708-603c9a6ae4cf(a)a21g2000yqn.googlegroups.com... >I have created a sub that builds a Pivot Table in an Excel > spreadsheet. The problem I am having is that the Column headers are > not being set. > > Here is the Sub: > > Sub Pivot > ' Pivot Table Macro > ' > Const xlPivotTableVersion10 = 1 > Const xlDatabase = 1 > Const xlRowField = 1 > Const xlColumnField = 2 > Const xlCount = -4112 > ' > wb2.PivotCaches.Create(xlDatabase,"Report! > R1C1:R65536C11",xlPivotTableVersion10).CreatePivotTable _ > "Sheet3!R1C1","PivotTable1",xlPivotTableVersion10 > ws3.Select > ws3.Cells(1, 1).Select > With ws3.PivotTables("PivotTable1").PivotFields("Server") > .Orientation = xlRowField > .Position = 1 > End With > With ws3.PivotTables("PivotTable1").PivotFields("KB#") '<--- this > is not working > .Orientation = xlColumnField > .Position = 1 > End With > ws3.PivotTables("PivotTable1").AddDataField ws3.PivotTables( _ > "PivotTable1").PivotFields("KB#"),"Count of KB#", xlCount ' Or > maybe this? > > End Sub > <--------------- End Code --------------- > > > I started out by creating a Macro in excel and then modifying it for > vbScript. The Pivot table is created but the Columns are not labeld. > > I have two columns ; Column A (1) is my server names and Column D (4) > is KB#. I want a count of each KB for each server. > > TIA
From: Al Dunbar on 28 Jul 2010 20:34 "Kenneth A. Larsen" <LarsenK(a)verizon.net> wrote in message news:OzUb68qLLHA.6128(a)TK2MSFTNGP06.phx.gbl... > > "OldDog" <mikef2691(a)comcast.net> wrote in message > news:508ad167-4090-4537-9708-603c9a6ae4cf(a)a21g2000yqn.googlegroups.com... >>I have created a sub that builds a Pivot Table in an Excel >> spreadsheet. The problem I am having is that the Column headers are >> not being set. >> >> Here is the Sub: >> >> Sub Pivot >> ' Pivot Table Macro >> ' >> Const xlPivotTableVersion10 = 1 >> Const xlDatabase = 1 >> Const xlRowField = 1 >> Const xlColumnField = 2 >> Const xlCount = -4112 >> ' >> wb2.PivotCaches.Create(xlDatabase,"Report! >> R1C1:R65536C11",xlPivotTableVersion10).CreatePivotTable _ >> "Sheet3!R1C1","PivotTable1",xlPivotTableVersion10 >> ws3.Select >> ws3.Cells(1, 1).Select >> With ws3.PivotTables("PivotTable1").PivotFields("Server") >> .Orientation = xlRowField >> .Position = 1 >> End With >> With ws3.PivotTables("PivotTable1").PivotFields("KB#") '<--- this >> is not working >> .Orientation = xlColumnField >> .Position = 1 >> End With >> ws3.PivotTables("PivotTable1").AddDataField ws3.PivotTables( _ >> "PivotTable1").PivotFields("KB#"),"Count of KB#", xlCount ' Or >> maybe this? >> >> End Sub >> <--------------- End Code --------------- > >> >> I started out by creating a Macro in excel and then modifying it for >> vbScript. The Pivot table is created but the Columns are not labeld. >> >> I have two columns ; Column A (1) is my server names and Column D (4) >> is KB#. I want a count of each KB for each server. >> >> TIA Kenny, why reply without adding anything to the discussion? /Al
|
Pages: 1 Prev: Excel pop3 issue Next: timer in IE |