title: Fetch maximum number of columns for a specific set of rows
body: <p>If I want to fetch the max number of columns for a set of rows in Excel, using Visual Studio, how would this be done?  </p>
  
  <p>Here is my current attempt which yields the maximum number of columns across the whole sheet instead of the specified rows. here are my attempts at this. All the necessary stuff such as using, initialize an Excel project etc are there, but not shown here.</p>
  
  <pre><code>class Sheets
  {
      public Excel.Application app;  //= new Excel.Application();
      public Excel.Workbook book;    //
      public Excel._Worksheet sheet; //= book.Sheets["XML Inputs"];
      public Excel.Range range;      // = sheet.UsedRange;
  
      public Sheets()
      {
          app = new Excel.Application();
          book = app.Workbooks.Open(@"C:\dev\Development\Joseph\Projects\PTAC XML File\PTAC XML File\Excel Read FIle 3.0.xlsx");
          sheet = book.Sheets["XML Inputs"];
          range = sheet.UsedRange;
  
          int rowcount = range.Rows.Count;
          int columncount = range.Columns.Count;
  
          int i = 0;
  
      }
  
      public void Output()
      {
  
          Excel.Range fastrange1 = (Excel.Range)sheet.Cells[12, 1]; //fetch the number of columns for row 12
  
  
          for (int i = 12; i == 12; i++)                            //given row 12, count the number of coulmns
          {
  
              int fastrange = range.Columns.Count;
              Console.WriteLine(fastrange);
          }
  </code></pre>
  
  <p>}</p>