اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم ورحمة الله وبركاته

أتمنى أيفيد أحد

Sub GetPiv() 'Excel VBA to Create a Pivot Table.
    Dim PTCache As PivotCache
    Dim Pt As PivotTable

    

      For Each Pt In ActiveSheet.PivotTables 'Checks and deletes any pivot tables.

        Pt.TableRange2.Clear

      Next Pt

 

    Set PTCache=ActiveWorkbook.PivotCaches.Create(xlDatabase, [A10].CurrentRegion)
    Set Pt=ActiveSheet.PivotTables.Add(PTCache, [G10])
 

    Pt.PivotFields("Desc").Orientation=xlColumnField

    Pt.PivotFields("Colour").Orientation=xlRowField

    Pt.PivotFields("Book").Orientation=xlDataField

    Pt.PivotFields("Market").Orientation=xlPageField

End Sub

 

Sub GetPiv2() 'Excel VBA create Pivot table in new worksheet.

    Dim PTCache As PivotCache

    Dim Pt As PivotTable

    Dim ws As Worksheet

    

    Set PTCache=ActiveWorkbook.PivotCaches.Create(xlDatabase, [A10].CurrentRegion)

    Set ws=Worksheets.Add

    Set Pt=ws.PivotTables.Add(PTCache, [A10])

    

    Pt.PivotFields("Desc").Orientation=xlColumnField

    Pt.PivotFields("Colour").Orientation=xlRowField

    Pt.PivotFields("Book").Orientation=xlDataField

    Pt.PivotFields("Market").Orientation=xlPageField

End Sub

 

Create Pivot Table with Excel VBA.rar

  • Thanks 1
  • 2 weeks later...
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information