2

I have slicers in my workbook that I need multi-select enabled by default.

I tried SendKeys.

ActiveSheet.Shapes.Range(Array("WMS")).Select
SendKeys "%S", True
ActiveSheet.Shapes.Range(Array("Equipment")).Select
SendKeys "%S", True
ActiveSheet.Shapes.Range(Array("Warehousing Skills")).Select
SendKeys "%S", True
ActiveSheet.Shapes.Range(Array("OCF Skills")).Select
SendKeys "%S", True

This selects the slicers as intended but the sendkeys did not enable multi-select.

I tried adding a pause before and after the sendkeys command.

I tried selecting two slicer options. This did not enable multi-select.

Community
  • 1
  • 1
Justin6587
  • 37
  • 1
  • 9
  • Are you trying to enable multi select, or to select multiple things (which you can do with VBA no matter whether multi select is set or not). – jeffreyweir Oct 30 '17 at 22:20
  • I am trying to enable multi-select. I know you can select multiple things with VBA. I did that hoping it would trigger the multi-select toggle, but it didnt. – Justin6587 Oct 31 '17 at 12:41

5 Answers5

2

One workaround could be that you select the slicer and then use SendKeys-method.

ActiveSheet.YOURSLICER.Select
SendKeys "%s"  || sends ALT+S key combination to toggle multiselect ON.
Puure
  • 21
  • 2
1

I don't believe you can programatically change that Multiselect toggle as at the time I write this...that property isn't exposed to the user via VBA. Looks like you've either got to go change that setting on all slicers manually, or teach your users to hold down the CTRL key while they make their selections (which lets them make multiple selections as if that toggle was activated).

jeffreyweir
  • 4,668
  • 1
  • 16
  • 27
1

Adding a DoEvents after each SendKeys command makes this work for me.

ActiveSheet.Shapes.Range(Array("WMS")).Select
SendKeys "%S"
DoEvents
ActiveSheet.Shapes.Range(Array("Equipment")).Select
SendKeys "%S"
DoEvents
Jeff
  • 11
  • 1
0

your code is correct. just replace the S with s and delete (, True).

0

Using Application.SendKeys made this work for me:

ActiveSheet.YOURSLICER.Select    
Application.SendKeys "%s"

Add DoEvents after SendKeys when working with more than one slicer.

ActiveSheet.YOURSLICER1.Select    
Application.SendKeys "%s"
DoEvents
ActiveSheet.YOURSLICER2.Select    
Application.SendKeys "%s"
DoEvents
...
zastaph
  • 1
  • 1