Pivotfields.currentpage Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about run-time error '1004' unable to set the currentpage property of the pivotfield class Stack Overflow the company Business Learn more about hiring developers or posting ads
Field.currentpage = Newcat
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow field.currentpage = newcat error is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting “Unable to set CurrentPage property of PivotField class” error up vote 2
Field.currentpage Error
down vote favorite I'm trying to use VBA to automatically update the pivot table filter based off the user's selection from a cell entry. I believe everything is working correctly up to line 11 which says "Field.CurrentPage = NewCat". This is where the issue lies. The code clears my filter as instructed in the previous line but when it gets to the code instructing it to select the new data unable to set the currentpage property of the pivotfield class olap I get the error that reads "Run-time error 1004. Unable to set CurrentPage property of PivotField class". Below is the what I have so far and I'm just looking how to revise row 11 so it selects the new input to use in the pivot table filter. I appreciate any help I can get on this. I'm very new to vba & have struggled with this for far too long! Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Range("C3:C4")) Is Nothing Then Exit Sub Dim pt As PivotTable Dim Field As PivotField Dim NewCat As String Set pt = Worksheets("Pivot").PivotTables("PivotTable1") Set Field = pt.PivotFields("[Range].[Site].[Site]") NewCat = Worksheets("Interface").Range("C3").Value With pt Field.ClearAllFilters Field.CurrentPage = NewCat pt.RefreshTable End With End Sub excel vba excel-vba share|improve this question asked Jan 15 at 18:11 Robin A 113 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote The answer is just a matter of syntax. If you change: With pt Field.ClearAllFilters Field.CurrentPage = NewCat pt.RefreshTable End With to: With Field .ClearAllFilters .CurrentPage = NewCat End With pt.RefreshTable It will work. Notice, that I work directly with the Field in the With Block. To illustrate further, if you change it to the following, it will work as well:
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code
Vba Currentpage Multiple Items
Every Time | Build Automated Trading Models In Excel | Excel
Xlcaptionequals
Web Pages | Excel Video Training Forum New Posts Control Panel FAQ Calendar Forum Actions Mark Forums Read pivotfilters.add example vba Quick Links Today's Posts Rules What's New? Advanced Search Forum HELP FORUMS Excel General Error: unable to set currentpage property of the pivot field class Excel Training / Excel http://stackoverflow.com/questions/34817213/getting-unable-to-set-currentpage-property-of-pivotfield-class-error Dashboards Reports If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the http://www.ozgrid.com/forum/showthread.php?t=169855 posts, register or log in above. New Features! We have added a new feature to the site - please visit the link below to read more about this OzGrid Features Update - 16th Oct 2016 Results 1 to 4 of 4 Thread: Error: unable to set currentpage property of the pivot field class Thread Tools Show Printable Version Search Thread Advanced Search September 17th, 2012 #1 zilosoft View Profile View Forum Posts I agreed to these rules Join Date 30th January 2012 Posts 7 Error: unable to set currentpage property of the pivot field class I have a pivot table whose details are being controlled by a combo box i.e after creating the pivot table, the pivot filter information was linked to a combo box. After linking the combo box with pivot filter so that combo box controls pivot table display, an error "unable to set the currentpage property of the pivot field class" is being received. Please find attached a sample sheet of the occurence. VB: Sub Test1() ActiveSheet.PivotTables("pvtTest").PivotFields("Week").ClearAllFilters ActiveSheet.PivotTables("pvtTest").PivotFields("Week").CurrentPage = _ ActiveSheet.Range("K1").Value En
Forums Excel Questions unable to set the currentpage property pf the pivotfield class Results 1 to 8 of 8 unable to set the currentpage property pf the pivotfield classThis is a discussion on unable to set the currentpage property http://www.mrexcel.com/forum/excel-questions/534641-unable-set-currentpage-property-pf-pivotfield-class.html pf the pivotfield class within the Excel Questions forums, part of the Question Forums category; Code: ActiveSheet.PivotTables("PivotTable1").PivotFields("Agent Name").CurrentPage = MyName ActiveSheet.PivotTables("PivotTable1").PivotFields("Date").CurrentPage = dselect Iam trying to update my pivot table with this code and i ... LinkBack LinkBack http://forum.chandoo.org/threads/vba-code-pivot-table-field-update-using-dropdown-list.14745/ URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Mar 9th, 2011,05:47 AM unable to #1 wish2excel New Member Join Date Aug 2010 Posts 20 unable to set the currentpage property pf the pivotfield class Code: ActiveSheet.PivotTables("PivotTable1").PivotFields("Agent Name").CurrentPage = MyName ActiveSheet.PivotTables("PivotTable1").PivotFields("Date").CurrentPage = dselect Iam trying to update my pivot table with this code and i am getting an error "unable to set the currentpage property pf the pivotfield class" Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Mar 9th, 2011,05:52 AM #2 Andrew Poulsom MrExcel MVPModerator Join unable to set Date Jul 2002 Posts 73,092 Re: unable to set the currentpage property pf the pivotfield class What's in the variables MyName and dselect and which line causes the error? What would the code look like if strings were used instead of variables? Share Share this post on Digg Del.icio.us Technorati Twitter Microsoft MVP - Excel Reply With Quote Mar 9th, 2011,10:07 PM #3 wish2excel New Member Join Date Aug 2010 Posts 20 Re: unable to set the currentpage property pf the pivotfield class the second line causes the error, the variables my name is for the agent name and dselect is for the date. Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Mar 10th, 2011,05:20 AM #4 Andrew Poulsom MrExcel MVPModerator Join Date Jul 2002 Posts 73,092 Re: unable to set the currentpage property pf the pivotfield class If you record a macro while selecting a date from the page field what do you get? I think you will find that the date is a string. Share Share this post on Digg Del.icio.us Technorati Twitter Microsoft MVP - Excel Reply With Quote Mar 10th, 2011,06:13 AM #5 wish2excel New Member Join Date Aug 2010 Posts 20 Re: unable to set the currentpage property pf the pivotfield class Code: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 10/03/2011 by
in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings. Yours, Chandoo Hi All Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam Post Spam and you Will Be Deleted as a User Hui... When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post. Welcome Message to New users Spam Sample File VBA Code: Pivot Table Field Update Using Dropdown List Discussion in 'VBA Macros' started by jdppep, Feb 7, 2014. jdppep Member Messages: 46 I am trying to update a pivot table field using a dropdown list. The code I have is below. I receive the following error when attempting: Run-time error '1004' Unable to set the CurrentPage property of the PivotField class Code (vb): Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Range("H5")) Is Nothing Then Exit Sub Dim pt As PivotTable Dim Field As PivotField Dim NewCat As String Set pt = Worksheets("P2").PivotTables("SpecialtyPivot") Set Field = pt.PivotFields("Specialty2") NewCat = Worksheets("P2").Range("H5").Value With pt Field.ClearAllFilters Field.CurrentPage = NewCat pt.RefreshTable End With End Sub Any help is appreciated! Thanks, Jared jdppep, Feb 7, 2014 #1 Luke M Excel Ninja Messages: 9,210 Is Specialty2 set as a Page/Report filter? Is the value of H5 a legitimate choice? If trying to do All, remember to include parenthesis "(All)" Luke M, Feb 7, 2014 #2 (You must log in or sign up to reply here.) Show Ignored Content Share This Page Tweet Your name or email address: Do you already have an account? No, create an account now. Yes, my password is: Forgot your password? Stay logged in Sign Up Now! Donate & thank our ninjas Chandoo.org Excel Forums - Become Awesome in Excel Home Forums > Forums > VBA Macros > Home Forums Forums Quick Links Search Forums What's New? Members Members Quick Links Notable Members Current Visitors Recent Activity Menu Search Search titles only Posted by Member: Separate names with a comma. Newer Than: Search this thread only Search this forum only Display results as threads Useful Searches Recent Posts More... Contact Us Help Home Top RSS Terms and Rules Privacy Policy Forum software by XenForo™ ©2010-2013 XenForo Ltd.