Results 1 to 17 of 17

Help on VBA to select all column dates into pivot fields

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-28-2016
    Location
    australia
    MS-Off Ver
    2019
    Posts
    194

    Help on VBA to select all column dates into pivot fields

    Dear expertise

    I have vba code to create pivot from rawdata of DIS_Q1-Q4 into newsheet Amortization, i want make change on code to take dates from column I till end of column CRM Becoz the date range extend by month wise report. so starting date from column header I till CRM header.


     Sub pivt()
    
     
     ActiveWorkbook.Sheets("DIS_Q1-Q4").Select
                r = Range("A1").End(xlDown).Row
                c = Range("A1").End(xlToRight).Column
         Set ws = Sheets.Add
                   ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
                SourceData:="DIS_Q1-Q4!R1C1:R" & r & "C" & c).CreatePivotTable _
                TableDestination:=ws.Name & "!R3C1", TableName:="PivotTable4"
                ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _
                    "PivotTable4").PivotFields("Capitalized Commissions"), "Sum of Capitalized Commissions", xlSum
    
               
                With ActiveSheet.PivotTables("PivotTable4")
                    .TableStyle2 = ""
                    .RowAxisLayout xlCompactRow
                      .PivotFields("Capitalized Quarter").Orientation = xlPageField
                      .PivotFields("CALL TYPE").Orientation = xlColumnField
                       .PivotFields("PUDO").Orientation = xlRowField
                    .PivotFields("PROD TYPE").Orientation = xlRowField
                                   .PivotFields("Capitalized Commissions").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
    'Instead of Capitalized commission i want all dates include pivot fields as sum with number format till CRM column'
    
                   
                  ActiveSheet.Name = "Amortization"
            ActiveWindow.Zoom = 85
            End With
              With ActiveSheet.PivotTables("PivotTable4")
            .InGridDropZones = True
            .RowAxisLayout xlTabularRow
        End With
           
    MsgBox ("Pivot Done")
    End Sub
    let me know any tricks or possbile at Calcualte field options too

    Please find the attachment
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Select dynamic entries in pivot row fields
    By sahilkh18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2016, 06:56 PM
  2. Select Multiple Dates In Report Filter Pivot Table But Dates Are Not Static
    By biasedobserver in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2014, 03:38 PM
  3. Compare 2 pivot fields and then de-select
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2011, 06:57 AM
  4. vba - select pivot fields
    By abz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2010, 09:18 AM
  5. Differentiate between column fields and data fields in a pivot table
    By whiteheadw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2009, 01:59 PM
  6. Select / deselect pivot table fields with check box
    By fynn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2008, 08:12 AM
  7. use combo box to select pivot table page fields
    By penfold in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2008, 09:55 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1