Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a C# code that use an excel appliction. In my code, I use the AutoFilter in a certain range. My question is how could I get the return values of the autofilter and manipulate/scan the return data. Below is my code taken in a certain procedu m_ExcelApp = new Excel.ApplicationClass(); m_ExcelApp.Visible = true; // make it visible Excel.Workbook wbActiveBook = m_ExcelApp.Workbooks.Open("d:\Sample.xls",Missing. Value,Missing.Value,Missing.Value,Missing.Value,Mi ssing.Value,Missing.Value,Missing.Value,Missing.Va lue,Missing.Value,Missing.Value,Missing.Value,Miss ing.Value,Missing.Value,Missing.Value); Excel.Worksheet wsActiveSheet = (Excel.Worksheet)wbActiveBook.Worksheets[1]; Excel.Range rYearRange = wsActiveSheet.get_Range("A1","Z784"); // Applying Filter on Column 11 where value is 2001 rYearRange.AutoFilter(11,"=2001",Excel.XlAutoFilte rOperator.xlAnd,Missing.Value,Missing.Value); // In Excel Sheet, it returns 3. // They said use the UsedRange but it doesn't return the desired output. Excel.Range retRange = wsActiveSheet.UsedRange.Cells.SpecialCells(Excel.X lCellType.xlCellTypeVisible,Missing.Value); Console.WriteLine(xRange.Rows.Count.ToString()); // but the counting returns only 1 :( Please help me with this endeavor. :( Regards, AdamPinoy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Does anyone has anyone has a solution for this? Please help. Regards. AdamPinoy wrote: Hi, I have a C# code that use an excel appliction. In my code, I use the AutoFilter in a certain range. My question is how could I get the return values of the autofilter and manipulate/scan the return data. Below is my code taken in a certain procedu m_ExcelApp = new Excel.ApplicationClass(); m_ExcelApp.Visible = true; // make it visible Excel.Workbook wbActiveBook = m_ExcelApp.Workbooks.Open("d:\Sample.xls",Missing. Value,Missing.Value,Missing.Value,Missing.Value,Mi ssing.Value,Missing.Value,Missing.Value,Missing.Va lue,Missing.Value,Missing.Value,Missing.Value,Miss ing.Value,Missing.Value,Missing.Value); Excel.Worksheet wsActiveSheet = (Excel.Worksheet)wbActiveBook.Worksheets[1]; Excel.Range rYearRange = wsActiveSheet.get_Range("A1","Z784"); // Applying Filter on Column 11 where value is 2001 rYearRange.AutoFilter(11,"=2001",Excel.XlAutoFilte rOperator.xlAnd,Missing.Value,Missing.Value); // In Excel Sheet, it returns 3. // They said use the UsedRange but it doesn't return the desired output. Excel.Range retRange = wsActiveSheet.UsedRange.Cells.SpecialCells(Excel.X lCellType.xlCellTypeVisible,Missing.Value); Console.WriteLine(xRange.Rows.Count.ToString()); // but the counting returns only 1 :( Please help me with this endeavor. :( Regards, AdamPinoy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Does anyone has a solution or work around with this problem? Please help. Regards. AdamPinoy wrote: Hi, I have a C# code that use an excel appliction. In my code, I use the AutoFilter in a certain range. My question is how could I get the return values of the autofilter and manipulate/scan the return data. Below is my code taken in a certain procedu m_ExcelApp = new Excel.ApplicationClass(); m_ExcelApp.Visible = true; // make it visible Excel.Workbook wbActiveBook = m_ExcelApp.Workbooks.Open("d:\Sample.xls",Missing. Value,Missing.Value,Missing.Value,Missing.Value,Mi ssing.Value,Missing.Value,Missing.Value,Missing.Va lue,Missing.Value,Missing.Value,Missing.Value,Miss ing.Value,Missing.Value,Missing.Value); Excel.Worksheet wsActiveSheet = (Excel.Worksheet)wbActiveBook.Worksheets[1]; Excel.Range rYearRange = wsActiveSheet.get_Range("A1","Z784"); // Applying Filter on Column 11 where value is 2001 rYearRange.AutoFilter(11,"=2001",Excel.XlAutoFilte rOperator.xlAnd,Missing.Value,Missing.Value); // In Excel Sheet, it returns 3. // They said use the UsedRange but it doesn't return the desired output. Excel.Range retRange = wsActiveSheet.UsedRange.Cells.SpecialCells(Excel.X lCellType.xlCellTypeVisible,Missing.Value); Console.WriteLine(xRange.Rows.Count.ToString()); // but the counting returns only 1 :( Please help me with this endeavor. :( Regards, AdamPinoy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
new data with autofilter on | Excel Worksheet Functions | |||
excel 2007 autofilter change to 2003 autofilter functionality? | Excel Discussion (Misc queries) | |||
2007 excel autofilter change back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
using autofilter data | Excel Worksheet Functions | |||
Excel - data autofilter, then data sort how do you view all | Excel Discussion (Misc queries) |