Count excel rows
-
I am opening putting data in an excel workbook, I am counting the rows with
rw=ws.range("1;1").specialcells(11)
Then add the code to the row below
ws.Cells(rw.row+1,1).Value = a ws.Cells(rw.row+1,2).Value = b ws.Cells(rw.row+1,3).Value = d ws.Cells(rw.row+1,4).Value = rs ws.Cells(rw.row+1,5).Value = rise
This works as intended but the cell that has formatting is considered not empty.
In excel vba I would use
rw=cells(rows.count,1).end(xlup).row
This will find the last row with something in it in column 1 and does not include formatting, such as borders.
Is there an equivalent to this in Ruby? -
Generally: Ruby can only use Excel via the WIN32OLE class, which just wraps OLE Automation. So it should be similar to VBA. In fact, I myself have this MS page bookmarked as the reference to use for WIN32OLE <-> Excel interaction:
Object model (Excel VBA reference) -
More Specifically: Would the
Range.Find
method help?
Range.Find method
Advertisement