简体   繁体   English

根据另一个枢轴字段更改枢轴字段

[英]Change a pivot field based on another pivot field

I'm trying to change a pivot field based on another pivot field in second sheet, and I'm getting a 'Run time error 13 Type Mismatch' Error 13 Documentation Sorry for not mentioning earlier data type is just a two letter string like FR, for france Here's my code 我正在尝试根据第二张工作表中的另一个枢轴字段来更改枢轴字段,并且遇到“运行时错误13类型不匹配” 错误13文档很抱歉,您未提到较早的数据类型只是两个字母的字符串,例如FR ,对于法国,这是我的代码

Sheets(Sheet1).PivotTables("PivotTable1").PivotFields("country_iso")_
  =Sheets(Sheet2).PivotTables("PivotTable9").PivotFields("country_iso")

It would help to know the datatypes involved... but without any more info, I would suggest adding Val(), if it is a number, or CStr(), if it is a string - around the value you're trying to assign: 这将有助于了解所涉及的数据类型...但是如果没有更多信息,我建议添加Val()(如果它是一个数字)或CStr()(如果它是一个字符串)-围绕您要尝试的值分配:

Sheets(Sheet1).PivotTables("PivotTable1").PivotFields("country_iso")_
   =Val(Sheets(Sheet2).PivotTables("PivotTable9").PivotFields("country_iso"))

or 要么

Sheets(Sheet1).PivotTables("PivotTable1").PivotFields("country_iso")_
   =CStr(Sheets(Sheet2).PivotTables("PivotTable9").PivotFields("country_iso"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM