Finding the last row in dataset

  • Thread starter Thread starter Bo Rasmussen
  • Start date Start date
B

Bo Rasmussen

Hi,

Suppose I have a dataset of varying length (i.e. number of rows) - how do I
use a worksheet function to figure out the rownumber of the last dataitem.
I'm creating an analyser for some datacommunication, and need some values
from the last row.

Regards
Bo Rasmussen
 
G³upia wrotka dla Bo Rasmussen:

hello people of internet ;)
Suppose I have a dataset of varying length (i.e. number of rows) - how do I
use a worksheet function to figure out the rownumber of the last dataitem.
I'm creating an analyser for some datacommunication, and need some values
from the last row.

try this:
Dim LastRow As Long

LastRow = Worksheets("Worksheet1").Cells.SpecialCells(xlCellTypeLastCell).Row

'last row with any value

LastRow = Worksheets("Worksheet1").ActiveSheet.UsedRange.Rows.Count

'last row with any value or format changed

LastRow = Worksheets("Worksheet1").Cells(65536, 1).End(xlUp).Row

'last row with any data in first column

Worksheets("Worksheet").Cells(LastRow + 1, 1).Value = "value"
Regards
Bo Rasmussen

regards
 
Hi
if you want a worksheetfunction for returning the last
value try
=LOOKUP(2,1/(1-ISBLANK(A1:A1000)),A1:A1000)
 
Back
Top