ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning values to Pivot field (https://www.excelbanter.com/excel-programming/363106-assigning-values-pivot-field.html)

cmungall

Assigning values to Pivot field
 
I am using a macro to assign a value to a pivot field. We have a drop-down
menu that the user selects a value from and through a vlookup, the value that
is selected from the menu is then selected in a specific pivot field. Our
problem is that when the macro runs, instead of just selecting the selected
value from the list contained in the pivot field, it actually changes the
current value to the new "user selected" value!

How do I go about telling excel to select the value from the list instead of
overwriting the current selection?

Here is what the macro looks like as of right now...

Sub ClassDescriptionSync()

With ActiveSheet.PivotTables("ClassDescTbl1")
.ManualUpdate = True
.PivotFields("Class Description").CurrentPage =
ActiveSheet.Range("O2").Value
.ManualUpdate = False
End With

End Sub

cmungall

Assigning values to Pivot field
 
Nevermind. I found a post by Tom Ogilvy from about two weeks ago that
answered my question wonderfully. Thanks Tom!

"cmungall" wrote:

I am using a macro to assign a value to a pivot field. We have a drop-down
menu that the user selects a value from and through a vlookup, the value that
is selected from the menu is then selected in a specific pivot field. Our
problem is that when the macro runs, instead of just selecting the selected
value from the list contained in the pivot field, it actually changes the
current value to the new "user selected" value!

How do I go about telling excel to select the value from the list instead of
overwriting the current selection?

Here is what the macro looks like as of right now...

Sub ClassDescriptionSync()

With ActiveSheet.PivotTables("ClassDescTbl1")
.ManualUpdate = True
.PivotFields("Class Description").CurrentPage =
ActiveSheet.Range("O2").Value
.ManualUpdate = False
End With

End Sub



All times are GMT +1. The time now is 11:24 AM.

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