'How can I turn on Data/Filter mode on Excel sheets from MATLABvia ActiveX?

My MATLAB code produces data that I want to send to Excel. I use ActiveX Server in MATLAB to both produce the Excel file and to do the export (I can control more properties of the resulting Excel file this way than by using the 'writetable' command). In the produced Excel file, I manually have to chose the menu 'Data/Filter' to turn on the function letting me filter and sort each column (visible as the small triangles in the column headings as shown in the illustration below).

How can I turn on this function with ActiveX from MATLAB?

Excel screenshot showing sort/filter dropdowns



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source