+ Reply to Thread
Results 1 to 11 of 11

Compile Error: VBA choosing multiple selections from PivotTable.

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Compile Error: VBA choosing multiple selections from PivotTable.

    Hello friends, Hope all is well!

    Trying to choose multi choices from Pivot table with VBA, but I keep getting the following error.

    Please help, and thank you very much in Advance!

    Compile Error: Variable Required - Can't assign to the is expression.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Hi,

    Try this :

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  4. #4
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Hello again!
    the code is not having any effect on the pivottable, i.e. not filtering. So, I put a single quotation mark on: ' On Error Resume Next '(Can't hide all fields)

    and when I ran the code I got the following error: Run time Error 1004:
    Application Defined or object-defined error.

    Please help

  5. #5
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    What's the name of your pivot table ?
    I put "Pivot Table1" in the code but it was not clear in the code you provided.

  6. #6
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    pivot table name is: PivotTable1. btw the field is placed in in the row section. and it is a powerpivot. does that matter?

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Quote Originally Posted by saudi_red_neck View Post
    and it is a powerpivot. does that matter?
    Yes. I'd pretty much guarantee none of the items have the names in your lists for an OLAP pivot table.
    Rory

  8. #8
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Hello again, sorry stuck again. the code works smoothly with PivotTables.
    But, can you please help me with having the code of case (Case "05100045", "03036001", "03036002", ...etc),
    read from whatever values listed is in the range A1:A100 of sheet "ABCDB".

    that would be better than placing the cases manually in the code itself.

    Your kind help will make the code far better. Thank you very much in advance!

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Hello,

    Here's a suggestion. You'll have to change the sheet name.
    The idea is to store the values in a dictionary and compare after.
    (assuming the values in A1:A100 are in string format "05100045", not number format like "5100045".

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Thank you GC, for some reason no change. I placed the attachment for testing purposes if you don't mind.

    formatting seems fine.

    Truly grateful; many thanks!
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Compile Error: VBA choosing multiple selections from PivotTable.

    Hi,

    A small modification required to the code according the to sample sheet you provided:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run-time error 1004: this action won't work on multiple selections
    By aprildu in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-08-2018, 12:50 PM
  2. [SOLVED] Find multiple selections values in Pivottable.Pagefields using VBA
    By fadydaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2014, 04:27 PM
  3. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  4. Run-time Error Multiple Selections SpecialCells xlCellTypeBlanks
    By goss in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2012, 08:59 PM
  5. Highlighting Multiple Selections That Don't Beging With an Error
    By Pherion in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2009, 04:41 PM
  6. [SOLVED] Remove old selections in Pivottable row field dropdown list
    By Mark Purvis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2006, 12:00 PM
  7. [SOLVED] Dropdown Selections in Excel - creating and choosing
    By Abi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1