search for the maximum
Posted
by peril brain
on Stack Overflow
See other posts from Stack Overflow
or by peril brain
Published on 2010-03-14T14:29:45Z
Indexed on
2010/03/14
14:35 UTC
Read the original article
Hit count: 178
c#
|excel-2007
I need to know a code that will automatically:-
- search a specific word in excel
- notes it row or column number (depends on data arrangement)
- searches numerical type values in the respective row or column
- with that numeric value(suppose a[7][0]or a[0][7]) it compares all other values of respective row or column(ie. a[i][0] or a[0][i])
- sets that value to the highest value only if IT HAS GOT NO FORMULA FOR DERIVATION
i know most of coding but at a few places i got myself stuck...
i'm writing a part of my program upto which i know:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application oExcelApp;
namespace a{
class b{
static void main(){
try
{
oExcelApp = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); ;
if(oExcelApp.ActiveWorkbook != null)
{Excel.Workbook xlwkbook = (Excel.Workbook)oExcelApp.ActiveWorkbook;
Excel.Worksheet ws = (Excel.Worksheet)xlwkbook.ActiveSheet;
Excel.Range rn;
rn = ws.Cells.Find("maximum", Type.Missing, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart,Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, false, Type.Missing, Type.Missing);
}}}
now ahead of this i only know tat i have to use cell.value2 ,cell.hasformula methods.....
& no more idea
can any one help me with this..
© Stack Overflow or respective owner