Read the post here: https://excelmacroclass.blogspot.com/...
In this video we see how to add slicers to a range or table in Excel using VBA macros. The macro first converts the target range into a table (if it's not already a table), and then adds a slicer to the header cell for each column. The height of the first row needs to be adjusted to fit in the slicer. The slicer is added to fit the cell by getting the left, top, width, and height properties of the top cell for each row.
Find more content and numerous macro examples and other Excel VBA learning materials in the Excel Macro Class blog under the direct link: https://excelmacroclass.blogspot.com/
And yet, if you want more, you can find various Excel templates, dashboards, and applications of different nature in the other blogs of the Excel Macro Mania saga:
Excel Macro Fun (https://excelmacrofun.blogspot.com/)
Excel Macro Business (https://excelmacrobusiness.blogspot.com/)
Excel Macro Sports (https://excelmacrosports.blogspot.com/)