Using VBA to auto-populate based off of slicer selection

New Contributor



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.



4 Replies
best response confirmed by kevintl98 (New 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.


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?

@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.

Works for me, I appreciate it.