Board index » delphi » Used/Last Row /col in Excel

Used/Last Row /col in Excel

How can I get Lastrow / userow  Lastcol / usecol from excel in delphi 5
 

Re:Used/Last Row /col in Excel


<<Johnny e:
How can I get Lastrow / userow  Lastcol / usecol from excel

Quote

If you've got a WS variable,
  WS := Excel.Activesheet as _Worksheet;
the simplest way is
  WS.UsedRange[lcid].Rows.Count;
Saving the worksheet first will update the UsedRange
property.

UsedRange is known to have problems, though, especially
with Excel 2000. You could use the CurrentRange property
instead, if you knew the range concerned was surrounded by
blank rows and columns. Another way is to use
  WS.Cells.SpecialCells(
      xlCellTypeLastCell, EmptyParam).Row;

--
Deborah Pate (TeamB) http://delphi-jedi.org

  Use Borland servers; TeamB don't see posts via ISPs
  http://www.borland.com/newsgroups/genl_faqs.html

Other Threads