Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got it working. Here's the code for people who are curious.</p> <pre><code>public static void findingTableBounds() { for (int column = 1; column &lt; currentRow; column++) { double? dateCol; dateCol = ((Excel.Range)workSheet.Cells[currentRow, 1]).Value2; if (dateCol == null) { Console.WriteLine("Total Row: {0}", totalRow); currentRow = 2; } else { currentRow++; totalRow++; } } for (int row = 1; row &lt; currentCol; row++) { double? headerRow; headerRow = ((Excel.Range)workSheet.Cells[1, currentCol]).Value2; if (headerRow == null) { Console.WriteLine("Total Column: {0}", totalCol); currentCol = 2; } else { currentCol++; totalCol++; } } } </code></pre> <p><em>Note</em> I made the currentRow and currentCol equal to 2 so that I could start reading the values from the table once I found the dimensions. It's not entirely necessary to do that, you can easily use other variables but I decided to use these variables later.</p> <p><em>UPDATE</em> With the help of other coders I got a bit of code for VB that automatically finds the last row of a table. The code is below:</p> <pre><code>Dim totalRow As Integer totalRow = Range("A1").End(xlDown).Row </code></pre> <p>Seeing how there are methods in VB for this, it makes me feel like there might be methods in C# to do the same thing... I just don't know what they are. Anyway the "End" method can also be used for finding the left, upper, and right boundaries as well, the Row method seems to extract the current row that the cursor in excel is on (here the cursor jumps to the last row because of the End method)</p> <p>Jesse</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload