Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row of data
hi,
i was wondering if there is a function that returns the row number of the last row of data in a file. i usually just loop down a column until cell value is empty but now i have a file that has empty cells in betweenm and this doesn't work. thanx a lot |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row of data
Hi Delali,
Try: Dim rw As Long rw = Cells(Rows.Count, "A").End(xlUp).Row --- Regards, Norman "delali" wrote in message ... hi, i was wondering if there is a function that returns the row number of the last row of data in a file. i usually just loop down a column until cell value is empty but now i have a file that has empty cells in betweenm and this doesn't work. thanx a lot |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row of data
delali wrote:
hi, i was wondering if there is a function that returns the row number of the last row of data in a file. i usually just loop down a column until cell value is empty but now i have a file that has empty cells in betweenm and this doesn't work. thanx a lot You could just continue to loop a la For i = 65536 To 1 Step -1 If Range("A" & i).Value < "" Then Exit For Next rw = i Unlike Norman Jones's suggestion, this will work if the last row of Column A has data. Perhaps faster for the same functionality would be to use the Find method, searching from Cell A1 backwards. Alan Beban |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last row of data
Dim rw As Long
if not isempty(Range("A" & rows.count)) then rw = rows.count else rw = Cells(Rows.Count, "A").End(xlUp).Row End if would also account for the last cell having data. -- Regards, Tom Ogilvy "Alan Beban" wrote in message ... delali wrote: hi, i was wondering if there is a function that returns the row number of the last row of data in a file. i usually just loop down a column until cell value is empty but now i have a file that has empty cells in betweenm and this doesn't work. thanx a lot You could just continue to loop a la For i = 65536 To 1 Step -1 If Range("A" & i).Value < "" Then Exit For Next rw = i Unlike Norman Jones's suggestion, this will work if the last row of Column A has data. Perhaps faster for the same functionality would be to use the Find method, searching from Cell A1 backwards. Alan Beban |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find formatting doesn't work: "Excel cannot find data" | Excel Discussion (Misc queries) | |||
Despite data existing in Excel 2002 spreadsheet Find doesn't find | Excel Discussion (Misc queries) | |||
The match and lookup functions can find literal data but not the same data referenced from a cell | Excel Discussion (Misc queries) | |||
FIND DATA WITHIN DATA (V-OR-H LOOKUP/FIND/MATCH?) | Excel Worksheet Functions | |||
I need to find a macro to find data cut and paste to another colu. | Excel Programming |