WebJul 7, 2024 · Try this (necessary comments in code): Sub fi () Dim lastRow As Long, foundRange As Range 'this will find last row for you, don't need to hard-code it lastRow = Cells (Rows.Count, 1).End (xlUp).Row 'I used nested ifs, as it will boost the performance 'it will stop checking next conditions if preceding condition fail For i = 1 To lastRow If ... WebMay 24, 2024 · 1. if you want the blank cell after the last used row (= last row filled with dada) then use lastRow + 1 because lastRow represents the last row filled with data. – Pᴇʜ. May 24, 2024 at 11:46. This happens with the + 1. – Hydes Yase. May 24, 2024 at 11:48. 1. So I can't guess what you are trying to achieve, you need to tell us your goal.
Find Last Row with Data in a Range Using Excel …
WebAnother way to get the last row for any given column, if you don't mind the overhead. Function GetLastRow (col, row) ' col and row are where we will start. ' We will find the last row for the given column. Do Until ActiveSheet.Cells (row, col) = "" row = row + 1 Loop GetLastRow = row End Function. Share. WebJul 12, 2012 · 2. This will give the last row in a given column. = Cells (Activesheet.Rows.Count, ColumnNumber).End (xlUp).Row (Fixed per @Gimp) you then have a reference you can use to add to the data - e.g if you want to look in column "A", then that would be columnnumber 1. feed that into the function, then you can use Cells … hammary 989-916
Code Not Pasting Fround Row [SOLVED] - excelforum.com
WebDec 30, 2016 · Add a comment. 2. You can set up a range, then just count the rows in the range: Sub t () Dim printRng As Range, lastRow As Long Set printRng = Range ("A1:F100") ActiveSheet.PageSetup.PrintArea = printRng lastRow = printRng.Row + printRng.Rows.Count - 1 Debug.Print "Last row of print area is: " & lastRow End Sub. … WebApr 26, 2024 · What I believe is occurring is that the End command within the worksheet will always stop at the last row of the table body, regardless if there is content in that row or not. Instead by using the End(xlUp) command from within the DataBodyRange, that then behaves as you're expecting to find the last used row. WebFeb 9, 2015 · Use worksheet.find (worksheet is your worksheet) and use the row-range for its range-object. You can get the rangeobject like: worksheet.rows(rowIndex) as example. Then give find the required parameters it should find it for you fine. If I recall correctly, find returns the first match per default. hammary 989-911