Search the Community
Showing results for tags 'array row count'.
-
Hi good day, please I need help with counting array rows, Im getting 0 value, but if I use ArrayExtract I can count the exact array row count. my question is why I cant get the array row count using $aResult? HotKeySet("{F2}", "Test") HotKeySet("{F3}", "CountRow") Global $aResult;, $aExtract While 1 Sleep(100) WEnd Func Test() ; Create application object and open an example workbook Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\testing.xlsx") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @DesktopDir & "\testing.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf Local $aResult = _Excel_RangeRead($oWorkbook, 1, "a1:e40", 2) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Data successfully read." & @CRLF & "Please click 'OK' to display the formulas of cells A1:C5 of sheet 1.") ;$aExtract = _ArrayExtract($aResult, 0, -1, 4, 4) $aDsply = _ArrayDisplay($aResult, "Excel UDF: _Excel_RangeRead Example 2 - Cells A1:e40 of sheet 1") EndFunc ;==>Test Func CountRow() $RowCount = UBound($aResult, $UBOUND_ROWS) MsgBox(64, "Success", "Row Count: " & $RowCount) EndFunc ;==>CountRow are there any other solution rather than _ArrayExtract???