From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the last row using the Cells object in Excel

Solved!
Go to solution

All,

I am trying to recreate the VBA code here in LabVIEW '16 to tell me what the last row is without hard-coding anything (like the cell address). Right now, I am calling a VBA function that tells me what the last row is in a particular column (A).

 

Sub LastRowInOneColumn()
'Find the last used row in a Column: column A in this example
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
MsgBox LastRow
End Sub

 

When I try to recreate the code in LabVIEW, I don't see the optional parameters  for the Cell object that you get when you code this with VBA. I am sure it is something that I am missing but maybe I just need another set of eyes to look at it. You'll see that I have tried to use the Range object, but that only results in an error. Any ideas?

0 Kudos
Message 1 of 3
(3,028 Views)
Solution
Accepted by topic author Eric1977

Why not use the built-in function, Excel Get Last Row?

 

get_last_row.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 3
(3,003 Views)

I had forgotten about that. Thank you.

0 Kudos
Message 3 of 3
(2,994 Views)