I know this thread is dead but given it ranks on Google I figured it would help if people got the answer in the future:
' Create pivot table
Set objtable = ActiveSheet.PivotTableWizard
ActiveSheet.Name = "cost rev analysis"
' Add Cost in as a data metric
Set objfield = objtable.PivotFields("Cost")
objfield.Orientation = xlDataField
' Add the period as a row variable
Set objfield = objtable.PivotFields("Period")
objfield.Orientation = xlRowField
'Add your revenue metric in as a data field. THIS IS WHERE I GOT VALUES IN THE ROW INSTEAD OF COLUMN FIELD
Set objfield = objtable.PivotFields(revenuemetric)
objfield.Orientation = xlDataField
' This line rearranges the "Data" to the column field, Data is essentially Values.
Set objfield = objtable.PivotFields("Data")
objfield.Orientation = xlColumnField
The first response put me onto this but could have been cleaer
thanks though!
Rich
Bookmarks