LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Last used row in Excel sheet

I want to know which is the last used row in an Excel sheet. I 'm using LV 7.0, Win2000 and Excel 97.
The demoprogram hangs when asking the value from the range. Killing Excel makes that the LV program stops.
What is the problem or is there an other way to get the last used cell from Excel ?

Thanks in advance,
Marc Van Hoeck
Download All
0 Kudos
Message 1 of 3
(3,098 Views)
Using "Range" method instead of "Cells" property. See the attached file. That's the main reason why Excel crashed.

To determine the last row, the simplest way is to use a macro (see VBA code below). You can write the Row number to a place your data is never going to be and read it in your VI. Or you can loop through each cell in a column to see if the current row is the last or not.

Sub test()
ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Select
Debug.Print ActiveCell.Row
End Sub


Joe
Message 2 of 3
(3,098 Views)
The Vi "ExcelUsedRange.vi" is in Labview 7.0 format .
I am using only Labview 6.1 and the vi seems just what i need. Could someone translate it into labview 6.1 format , please ?
Thaks in advance
0 Kudos
Message 3 of 3
(3,098 Views)