Help us understand the problem. What is going on with this article?

【VBA】ピボットテーブルについて

More than 1 year has passed since last update.

ピボットテーブルをマクロで扱う際は、Excel2010とそれ以降で構文が異なります。
以下に例を記載します。

■Excel2010で作成

        'ピボットテーブル作成
        ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
            wks_ARRAY(i).Cells(1, 1).CurrentRegion, Version:=xlPivotTableVersion14).CreatePivotTable _
           TableDestination:=Cells(3, 1), TableName:=str_PIVOT_TABLE_NAME(i), DefaultVersion:=xlPivotTableVersion14

■Excel2016で作成

        ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
            wks_ARRAY(i).Cells(1, 1).CurrentRegion, Version:=6).CreatePivotTable TableDestination:= _
            Cells(3, 1), TableName:=str_PIVOT_TABLE_NAME(i), DefaultVersion:=6

Excel2016でマクロを作成している場合、
【Version:=xlPivotTableVersion14】
を指定しないとExcel2010では下記エラーを出力して停止します。
「プロシージャの呼び出し、または引数が不正です。」

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away