LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find first empty row in Excel worksheet?

Using LabWindows/CVI 6.0 and Microsoft Excel 9.0 Object Library, how do I use ActiveX to find the last row of a worksheet with data in it? I have a template worksheet that I write measurement results to as the results are generated. So far I can successfully write the results via ActiveX to the template worksheet. Now, after saving the worksheet I need to be able to open it via ActiveX and determine which row is the last one containing data so that I may increment one row and write the next piece of data.

Thanks for the assistance.
0 Kudos
Message 1 of 3
(4,050 Views)
Aaron,

I'm not very familiar with Excel's ActiveX interface, however as an idea you could have a cell in Excel that holds the count of items found in the row where your column headers are. You can have this cell is some lost place or in a hidden cell. Your app can then read the value of that cell and know where to inset the data.

I hope this helps.

Regards,

Juan Carlos
N.I.
Message 2 of 3
(4,050 Views)
I had the same problem one year ago and I solved it as follows: I put in a for loop (counting from 1 to 65536, the maximum number of records an excel file can hold) the function, of the excel report library, that Get the attributes of a cell value. Between these attributes there is one that indicates the cell is empty. The best tip is to look at the examples supplied with CVI, into the directory excelreport. I hope this message will help you. Bie.
0 Kudos
Message 3 of 3
(4,050 Views)