This code finds the last empty row in a column - lastRowF = wsjr.Cells(wsjr.Rows.count,…
- User
This code finds the last empty row in a column - lastRowF = wsjr.Cells(wsjr.Rows.count, "F").End(xlUp).Row + 1. Is it possible to find the last empty row in a range
- Assistant
of cells instead of just a single column?
Yes, it is possible to find the last empty row in a range of cells. Here is an example code that finds the last empty row in a range of cells A1:B10:
Dim lastRow As Long lastRow = Range("A1:B10").Find(What:="", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1This code uses the Find method to search for the last occurrence of an empty cell in the range A1:B10. It searches by rows (xlByRows) and in a backward direction (xlPrevious). Once it finds the last empty cell, it gets the row number and adds one to get the last empty row.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.