tim8w
tim8w
CC#
Created by tim8w on 1/29/2024 in #help
C#.Net Excel Interop Autofilter Range
Turns out I left out an important piece of information. The Worksheet that the Range is working on was created by doing a Worksheet.Copy(). I did a little research and found the following quote which explains the problem I think:
*Note Whether you copy the worksheet programmatically, or the end user copies the worksheet manually, there is no code behind the new worksheet and controls on the new worksheet do not function. This is because the newly copied worksheet is a Worksheet object and not a Worksheet host item. Windows Forms controls and host controls can only be added to host items. For more information, see Programmatic limitations of host items and host controls.
So I did the Filter on the Original first, then copied it and then closed the original without saving it and everything worked!
2 replies