Forum Discussion

kevintl98's avatar
kevintl98
Copper Contributor
Nov 16, 2021
Solved

Using VBA to auto-populate based off of slicer selection

Hello,

 

I am fairly new to using VBA so I am unsure on how to write code to auto-populate H5 with the respective radius value based off of the tank selection slicer. If anyone could help me out or give me some insight I would appreciate it.

 

  • kevintl98 You didn't upload your file, so I made something myself. Since you only will select on tank at the time, you can use AGGREGATE (sum) in combination with visible cells only to pick up the value of the selected slicer option.

     

    See attached.

     

4 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    kevintl98 You didn't upload your file, so I made something myself. Since you only will select on tank at the time, you can use AGGREGATE (sum) in combination with visible cells only to pick up the value of the selected slicer option.

     

    See attached.

     

    • kevintl98's avatar
      kevintl98
      Copper Contributor
      Hi Riny, this is exactly what I needed thank you for it! Is there a way to prevent the sum of the table showing up prior to selecting a slicer?
      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        kevintl98 Perhaps not the most elegant solution, but if you use the original formula as a helper cell (hidden below the slicer), you can build another formula in H5. See attached.

Resources