ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting pivot field using vba (https://www.excelbanter.com/excel-programming/351854-setting-pivot-field-using-vba.html)

h2o[_2_]

Setting pivot field using vba
 

Hi all,

I'm running into a problem when I tried to set the value of pivot fiel
(eg. Segment). It works fine when the input SEG exists in the drop dow
menu. However, I can't seem to get it to choose (blank) if SEG no
found.

Any comments or ideas are welcomed. Thanks in advance!



If ActiveSheet.PivotTables("PivotTable1").PivotFields ("Segment").Value
= SEG Then
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Segment"). _
CurrentPage = "(blank)"
Else
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Segment"). _
CurrentPage = SEG
End I

--
h2
-----------------------------------------------------------------------
h2o's Profile: http://www.excelforum.com/member.php...fo&userid=3098
View this thread: http://www.excelforum.com/showthread.php?threadid=50653



All times are GMT +1. The time now is 01:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com