+ Reply to Thread
Results 1 to 10 of 10

Adding macro to reset selection

  1. #1
    Registered User
    Join Date
    09-06-2021
    Location
    Northern Ireland
    MS-Off Ver
    365
    Posts
    20

    Adding macro to reset selection

    It is possible to add a macro to my dashboard that will do the following:

    For cell B2 select England and for cell E2 select Please Select.

    I would like to add this to a form control box that will essentially reset the dropdown selections to these values.

    Thanks in advance

    I am new, this forum has been a lifesaver.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Adding macro to reset selection

    Parhaps this?
    Please Login or Register  to view this content.
    BSB

  3. #3
    Registered User
    Join Date
    09-06-2021
    Location
    Northern Ireland
    MS-Off Ver
    365
    Posts
    20

    Re: Adding macro to reset selection

    Thanks this worked perfect.

    Would you happen to know why when I select East of England and Yorkshire and Humber GETPIVOTDATA is displaying #REF!?

    Thanks

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Adding macro to reset selection

    EoE and Y&H in your pivot table have trailing spaces after them. This means that Excel cannot find them in the pivot data. "East of England " (with trailing space) is different to "East of England" (without trailing space).
    Fix that issue at the source and all should work as planned.

    BSB

  5. #5
    Registered User
    Join Date
    09-06-2021
    Location
    Northern Ireland
    MS-Off Ver
    365
    Posts
    20

    Re: Adding macro to reset selection

    Amazing this is great.

    One last thing before I close the thread. I want to create a table using the same dropdown options. Is it possible to enable multi selection? The dashboard only has one which is perfect but would like the option of selecting more than one in a table format.

    Thanks

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Adding macro to reset selection

    Not sure what you mean by "create a table" in this instance. A pivot table?

    You can apply filters to those so you can select only certain areas for example. Is that what you mean?

    BSB

  7. #7
    Registered User
    Join Date
    09-06-2021
    Location
    Northern Ireland
    MS-Off Ver
    365
    Posts
    20

    Re: Adding macro to reset selection

    Apologies I am probably not being very clear.

    In the attached excel tab "table" I have used the same drop down options. In this table format is there any way I can add a macro to allow more than one selection to populate the columns of the table respectively?

    Thanks
    Attached Files Attached Files

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Adding macro to reset selection

    Hmmmm.... Maybe. I'd need to think about it for a while.

    My first question would be what would the results look like? If summed together for say two areas selected the numbers would work but the percentages wouldn't if you summed them together.

    Perhaps using some hidden helper columns/tables it could be done....

    BSB

  9. #9
    Registered User
    Join Date
    09-06-2021
    Location
    Northern Ireland
    MS-Off Ver
    365
    Posts
    20

    Re: Adding macro to reset selection

    If it was possible to add an additional column per selected area from the drop down. No to sum values but just show them as an additional column to mimic what a slicer would do in a pivot table?

    Thanks

  10. #10
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Adding macro to reset selection

    What about something like this?

    I've added another button "Show Data" that will run the 2nd of the two subs below. It could probably be written better but I think it does what you need as it is.
    It will add a new column to the table with the selected region/area's figures.

    I've then slighty amended your ResetTable sub so it will delete any extra columns and clear the table back to empty.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Give it a try and see if it does what you need.

    BSB
    Attached Files Attached Files

+ 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. Help with Center Across Selection Getting Reset Running at END IF Portion of VBA Code
    By ExcelMeister10520 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2019, 11:24 PM
  2. [SOLVED] Reset Contents Of Form With A Specific Drop-Down Selection
    By AJMPack in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2017, 05:57 PM
  3. [SOLVED] Reset ComboBox After Making A Selection
    By Liz3nz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 02:14 PM
  4. [SOLVED] Adding additional selection criteria to existing Macro
    By Mogpot1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2013, 10:29 AM
  5. [SOLVED] Command button to reset ComboBox selection
    By Darrenh1238 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 06:14 AM
  6. how do you reset the selection of a listbox
    By reddwarf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2009, 05:59 PM
  7. Replies: 9
    Last Post: 07-28-2006, 08:40 AM

Tags for this Thread

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