FOR nArea=1 TO oRange.Areas.Count FOR nRow = 1 TO oRange.Areas.Item(nArea).Rows.Count FOR nColumn= 1 TO oRange.Areas.Item(nArea).Columns.Count IF !EMPTY(orange.Areas(nArea).Cells[nRow,nColumn].Value) ? nRow, nColumn, oRange.Areas(nArea).Cells[nRow,nColumn].Value ENDIF ENDFOR ENDFOR ENDFOR>Try
? oRange.Areas.Count >FOR i=1 TO oRange.Areas.Count > ? oRange.Areas.Item(i).Rows.Count >ENDFOR >>>I have an Excel 2003 (SP2) workbook with one worksheet. That one worksheet is two pages long. I have a named range, called "PCNS", that covers column A, rows 10 thru 15 AND column A on the second page, rows 100 thru 110. That should mean the "PCNS" range covers 15 rows, correct? Well, when I run the following, it only shows me the first 5 rows. Anyone know how to show all 15 rows???
>>='Sheet1'!$A$10:$A$15,'Sheet1'!$A$100:$A$110 >>>>
>>CLEAR >>SET ESCAPE ON >> >>oExcel= CREATEOBJECT("Excel.Application") >>oWorkBook = oExcel.WorkBooks.OPEN("MyExcel.xls", .F., .T.) &&Don't update links, and readonly. >> >>oRange = oExcel.RANGE("PCNS") >>? oRange.ROWS.COUNT, "rows" >>? oRange.COLUMNS.COUNT, "columns" >>? >>FOR nRow = 1 TO oRange.ROWS.COUNT >> FOR nColumn= 1 TO oRange.COLUMNS.COUNT >> ? nrow, ncolumn, oRange.Cells[nRow, nColumn].VALUE >> ENDFOR >>ENDFOR >> >>oExcel.ActiveWorkbook.Close(0) &&Close without saving! >>oExcel.QUIT() >>RELEASE oRange >>RELEASE oWorkBook >>RELEASE oExcel >>