|
-
May 21st, 2013, 09:50 AM
#1
Thread Starter
New Member
Creating Macro-Fundamental questions
Hello All,
New to the forum and new to VB. I am creating a basic macro and need some help with getting the pivot to display some things correctly.
Below is an example of my script so far:
Sub CreatePivot()
' Pvt Table IP by Order
Dim objTable As PivotTable, objField As PivotField
ActiveWorkbook.Sheets("2012 DEC YTD FLK INPT DATA").Select
Range("A1").Select
Set objTable = Sheet1.PivotTableWizard
ActiveSheet.Name = "Pvt Table IP by Order"
Set objField = objTable.PivotFields("ORDER")
objField.Orientation = xlRowField
Set objField = objTable.PivotFields("DISCH QTR")
objField.Orientation = xlPageField
Set objField = objTable.PivotFields("CASES")
objField.Orientation = xlDataField
objField.Function = xlSum
objField.NumberFormat = "$ #,##0"
..(Continue adding DataFields)...etc...
Question 1. When I run the macro it sums by RowField when I would like it sum by ColumnField. What do I need to add in my script to get that to work?
Question 2. In regards to xlPageField... How can I specifically make a QTR selection? (.Position?). My goal is to use create 4 tabs (1 for each quarter). Currently this just shows the dropdown with ALL being checked vs. a particular QTR being selected.
Hope my questions are clear, and thanks in advance!
~Evan
-
May 23rd, 2013, 02:46 PM
#2
Thread Starter
New Member
Re: Creating Macro-Fundamental questions
Anyone out there that can lend a hand?????? I have no resources at work for VBA. I am thinking this will be easy for those of you who know it..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|