Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AutoFilter Data

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AutoFilter Data

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AutoFilter Data

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
new data with autofilter on joanneed Excel Worksheet Functions 0 January 10th 11 10:27 PM
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
using autofilter data edward Excel Worksheet Functions 2 June 23rd 09 02:18 PM
Excel - data autofilter, then data sort how do you view all Peg Excel Discussion (Misc queries) 2 April 23rd 08 11:11 PM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"