Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP5 and 7: Determine last row of a Excel spreadsheet

Status
Not open for further replies.

cj001

Programmer
Oct 3, 2001
145
0
0
US
Hello,

I have an Excel file with spreadsheets of varying lengths.

How do i determine what is the last row of an Excel spreadsheet?

THANKS!
CJ
 
CJ,

I take it you mean the last row actually used. If so, how about something like this:

oExcel.Selection.SpecialCells(11).Select

That will move the pointer to the last row used. You can then look at the active cell's row number.

If that doesn't work, and if you don't get a better answer, try posting in an Excel or VBA-related forum, as it's not really a VFP issue.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 

I creating these worksheets originally with VFP.

Yes, I am looking for the last row actually used.
 
' Get the number of rows of the selection.
RowCount = Selection.Rows.Count
' Get the number of columns of the selection.
ColumnCount = Selection.Columns.Count
' Activate the last cell of the selection.
Selection.Cells(RowCount, ColumnCount).Activate

Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top