VBA for pivot table

hi,
I wanted to create pivot table with vba .
I am not good in VBA, so please anyone can help me to create a vba code for me.
I also try to find code from other sites, but didn’t get any output.

here, I am attaching the data file and also the pivot output so that everyone can easily understand.
pivot data.xlsx (13.8 KB)

thanks in advance

@Lakshya_Garg i can try

You can record macro and then it will generate a VBA code which contain step by step you done.

From this code, you can customize again to use.

Or you can record macro on that file and then upload file into here, i will support you to customize.

PivotTables Example.zip (112.7 KB)

Description is in the workflow inside Invoke VBA Activity.
The function was tested on following scenarios:

  1. Valid data:
    a) Making table with only rows, Sum and Count
    b) Making table with only columns, Sum and Count
    c) Making tables with rows and columns, Sum and Count

  2. Invalid data:
    a) wrong sheet name
    b) wrong field names (rows, columns)

Hope that it helps!

Here is the code
vba5.txt (2.3 KB)