+ Reply to Thread
Results 1 to 10 of 10

Combo Box Code

  1. #1
    Forum Contributor
    Join Date
    04-11-2008
    Posts
    156

    Combo Box Code

    Hi there,

    The following code allows me to contol a pivot table's page fields using a combobox when both the pivot table and the combo box are on the same page.

    Please can you show me how to adapt the code so that I can have the combo box in a separate sheet to the pivot table.

    Many thanks

    Behind Pivot Sheet:

    Please Login or Register  to view this content.

    Behind ThisWorkbook module:

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    The ME reference in your code refers to the worksheet the pivottable and combo box are on.

    If you replace pivot tables ME reference with a reference to the worksheet you should be okay.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    04-11-2008
    Posts
    156
    Andy,

    Thank you for your response.

    I have tried the referencing as you described but it does not seem to work (although I am not getting an error message).

    Would you mind taking a look at the attached to see where I am going wrong.

    Many thanks
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Try

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-11-2008
    Posts
    156
    Andy,

    Thanks again. Unfortunately still no joy. Please could you take another look?

    Thanks so much.

    My code is as follows (spreadsheet also attached):

    Sheet 4 (Sheet PT is on):
    Please Login or Register  to view this content.
    This Workbook:
    Please Login or Register  to view this content.
    Thank you
    Attached Files Attached Files
    Last edited by penfold; 07-15-2008 at 07:13 AM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    04-11-2008
    Posts
    156
    Hi Andy,

    Thanks again.

    I Copy and Pasted your code as per the attached but still no joy. I don't get an error message it just doesn't seem to work.

    I'm not sure if you revised the attachment because I can't seem to open it without it corrupting.

    Please can I ask for your help once more.

    Many thanks
    Attached Files Attached Files

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Yes but you posted the combo boxes change event code to a sheet which does not have a combobox.

    The event code needs to be on the same sheets as the combobox, as per my example.

  9. #9
    Forum Contributor
    Join Date
    04-11-2008
    Posts
    156
    Thank you!! I've managed to download the attachment and it works a treat!!

    I've tried to add a 2nd combo box to control the 2nd page field (Gender) by repeating and amending the code but I've not managed to succeed.

    Please can you take a look at the attached?

    Thank you.
    Attached Files Attached Files

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    You were using LCase in the select statement which made the case either "m" or "f", which of course it never would be.
    Try this revision.

    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)

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